Ignore:
Timestamp:
Aug 29, 2009, 3:22:10 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Some more fgets => mr_getline transformations
  • XWIN define is gone
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-raid.c

    r2334 r2357  
    427427int get_next_raidtab_line(FILE * fin, char *label, char *value)
    428428{
    429     char *incoming;
     429    char *incoming = NULL;
    430430    char *p;
    431431
    432     malloc_string(incoming);
    433432    assert(fin != NULL);
    434433    assert(label != NULL);
     
    437436    label[0] = value[0] = '\0';
    438437    if (feof(fin)) {
    439         paranoid_free(incoming);
    440438        return (1);
    441439    }
    442     for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    443          fgets(incoming, MAX_STR_LEN - 1, fin)) {
    444         strip_spaces(incoming);
     440    for (mr_getline(incoming, fin); !feof(fin); mr_getline(incoming, fin)) {
     441        mr_strip_spaces(incoming);
    445442        p = strchr(incoming, ' ');
    446443        if (strlen(incoming) < 3 || incoming[0] == '#' || !p) {
     444            mr_free(incoming);
    447445            continue;
    448446        }
     
    453451        strcpy(label, incoming);
    454452        strcpy(value, p);
    455         paranoid_free(incoming);
     453        mr_free(incoming);
    456454        return (0);
    457455    }
     456    mr_free(incoming);
    458457    return (1);
    459458}
     
    805804    static char *argv[64];
    806805    char **ap;
    807     char *line = (char *) malloc(MAX_STR_LEN);
    808     if (!line)
    809         errx(1,
    810              "unable to allocate %i bytes of memory for `char *line' at %s:%i",
    811              MAX_STR_LEN, __FILE__, __LINE__);
    812     (void) fgets(line, MAX_STR_LEN, f);
     806    char *line = NULL;
     807
     808    mr_getline(line, f);
    813809    if (feof(f)) {
    814810        log_it("[GNVCL] Uh... I reached the EOF.");
     
    822818            cnt++;
    823819        }
     820    mr_free(line);
    824821
    825822    if (strchr(argv[cnt - 1], '\n')) {
Note: See TracChangeset for help on using the changeset viewer.