Ignore:
Timestamp:
Jul 17, 2006, 3:44:46 PM (13 years ago)
Author:
bcornec
Message:

Huge memory management patch.
Still not finished but a lot as been done.
What remains is around some functions returning strings, and some structure members.
(Could not finish due to laptop failure !)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-raid.c

    r672 r688  
    774774{
    775775    int cnt = 0;
    776     static char *argv[64];
     776    char *argv[64];
    777777    char **ap;
    778     char *line = (char *) malloc(MAX_STR_LEN);
    779     if (!line)
    780         errx(1,
    781              "unable to allocate %i bytes of memory for `char *line' at %s:%i",
    782              MAX_STR_LEN, __FILE__, __LINE__);
    783     (void) fgets(line, MAX_STR_LEN, f);
     778    char *line = NULL;
     779    size_t = 0;
     780    int lastpos = 0;
     781
     782    getline(&line, &n, f);
    784783    if (feof(f)) {
    785784        log_it("[GNVCL] Uh... I reached the EOF.");
    786         return 0;
    787     }
    788 
    789     for (ap = argv; (*ap = strsep(&line, " \t")) != NULL;)
     785        return NULL;
     786    }
     787
     788    for (ap = argv; (*ap = mr_strtok(line, " \t", &lastpos)) != NULL;)
    790789        if (**ap != '\0') {
    791790            if (++ap >= &argv[64])
Note: See TracChangeset for help on using the changeset viewer.