Changeset 63308


Ignore:
Timestamp:
Nov 30, 2014, 11:47:06 PM (10 years ago)
Author:
mmetz
Message:

libgis: optimize G_chop()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass/trunk/lib/gis/strings.c

    r60203 r63308  
    296296    }
    297297
    298     for (t = line; *t; t++)     /* go to end */
     298    for (t = f; *t; t++)        /* go from first non white-space char to end */
    299299        ;
    300300    while (isspace(*--t)) ;
    301301    *++t = '\0';                /* remove trailing white-spaces */
    302302
    303     t = line;
    304     while (*f)                  /* copy */
    305         *t++ = *f++;
    306     *t = '\0';
     303    if (f != line) {
     304        t = line;
     305        while (*f)              /* leading white spaces, shift */
     306            *t++ = *f++;
     307        *t = '\0';
     308    }
    307309
    308310    return (line);
Note: See TracChangeset for help on using the changeset viewer.