a/src/utils/smallut.cpp b/src/utils/smallut.cpp
...
...
426
426
427
/* Truncate a string to a given maxlength, avoiding cutting off midword
427
/* Truncate a string to a given maxlength, avoiding cutting off midword
428
 * if reasonably possible. Note: we could also use textsplit, stopping when
428
 * if reasonably possible. Note: we could also use textsplit, stopping when
429
 * we have enough, this would be cleanly utf8-aware but would remove 
429
 * we have enough, this would be cleanly utf8-aware but would remove 
430
 * punctuation */
430
 * punctuation */
431
static const string SEPAR = " \t\n\r-:.;,/[]{}";
431
static const string cstr_SEPAR = " \t\n\r-:.;,/[]{}";
432
string truncate_to_word(const string &input, string::size_type maxlen)
432
string truncate_to_word(const string &input, string::size_type maxlen)
433
{
433
{
434
    string output;
434
    string output;
435
    if (input.length() <= maxlen) {
435
    if (input.length() <= maxlen) {
436
    output = input;
436
    output = input;
437
    } else {
437
    } else {
438
    output = input.substr(0, maxlen);
438
    output = input.substr(0, maxlen);
439
    string::size_type space = output.find_last_of(SEPAR);
439
    string::size_type space = output.find_last_of(cstr_SEPAR);
440
    // Original version only truncated at space if space was found after
440
    // Original version only truncated at space if space was found after
441
    // maxlen/2. But we HAVE to truncate at space, else we'd need to do
441
    // maxlen/2. But we HAVE to truncate at space, else we'd need to do
442
    // utf8 stuff to avoid truncating at multibyte char. In any case,
442
    // utf8 stuff to avoid truncating at multibyte char. In any case,
443
    // not finding space means that the text probably has no value.
443
    // not finding space means that the text probably has no value.
444
    // Except probably for Asian languages, so we may want to fix this 
444
    // Except probably for Asian languages, so we may want to fix this 
...
...
674
  ts->tv_sec = tv.tv_sec;
674
  ts->tv_sec = tv.tv_sec;
675
  ts->tv_nsec = tv.tv_usec * 1000;
675
  ts->tv_nsec = tv.tv_usec * 1000;
676
}
676
}
677
///// End system interface
677
///// End system interface
678
678
679
// Note: this not protected against multithread access and not reentrant, but
680
// this is mostly debug code, and it won't crash, just show bad results. Also 
681
// the frozen thing is not used that much
679
static m_timespec frozen_tv;
682
static m_timespec frozen_tv;
680
void Chrono::refnow()
683
void Chrono::refnow()
681
{
684
{
682
  gettime(CLOCK_REALTIME, &frozen_tv);
685
  gettime(CLOCK_REALTIME, &frozen_tv);
683
}
686
}