Ignore:
Timestamp:
Jun 19, 2013, 8:34:46 AM (11 years ago)
Author:
Bruno Cornec
Message:
  • First pass on svn merge -r 2935:3146 ../3.0
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/mondo/src/common/libmondo-string.c

    r2508 r3147  
    665665 */
    666666void strip_spaces(char *in_out)
     667{
     668    /*@ buffers ***************************************************** */
     669    char *tmp = NULL;
     670
     671    /*@ int ******************************************************** */
     672    int i;
     673
     674    /*@ end vars *************************************************** */
     675
     676    assert(in_out != NULL);
     677    malloc_string(tmp);
     678    for (i = 0; in_out[i] <= ' ' && i < (int) strlen(in_out) -1; i++);
     679    strcpy(tmp, in_out + i);
     680    for (i = (int) strlen(tmp) -1; i >= 0 && tmp[i] <= ' '; i--);
     681    i++;
     682    tmp[i] = '\0';
     683
     684    // Now tmp contains the stripped string
     685    strcpy(in_out,tmp);
     686    paranoid_free(tmp);
     687}
     688
     689/**
     690 * Remove all characters whose ASCII value is less than or equal to 32
     691 * (spaces and control characters) from both sides of @p in_out.
     692 * @param in_out The string to strip spaces/control characters from (modified).
     693 */
     694void strip_spaces2(char *in_out)
    667695{
    668696    /*@ buffers ***************************************************** */
     
    752780 * @return @p partition.
    753781 */
    754 char *truncate_to_drive_name(char *partition)
     782char *truncate_to_drive_name(const char *partition)
    755783{
    756784    int i = strlen(partition) - 1;
Note: See TracChangeset for help on using the changeset viewer.