Ignore:
Timestamp:
Feb 6, 2011, 3:35:12 PM (9 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Display rendering in caca window
File:
1 edited

Legend:

Unmodified
Added
Removed
  • gaycko/trunk/src/helpers/str.c

    r4748 r4755  
    1212#include "str.h"
    1313#include <string.h>
     14#include <stdlib.h>
    1415
    1516
     
    2526}
    2627
    27 void strip_spaces(char *str) {
     28void strip_spaces(char **os) {
     29    char *str = *os;
    2830        int s = strlen(str)+1;
     31    int i = 0;
    2932   
    30     (void)s;
    31    
    32 
     33    for(i = 0; i < s-1; i++) {
     34        if(str[i] == ' ' &&
     35           str[i+1] == ' ') {
     36                memcpy(&str[i], &str[i+1], s-i);
     37            s--;
     38            str = realloc(str, s);
     39        }
     40    }
    3341}
Note: See TracChangeset for help on using the changeset viewer.