Changeset 3509 in MondoRescue for branches/3.2/mondo/src/lib/mr_mem.c


Ignore:
Timestamp:
Feb 13, 2016, 2:57:55 AM (4 years ago)
Author:
Bruno Cornec
Message:
  • Change mr_msg_int interface by adding the FUNCTION macro
  • Use mr_msg in mr_system
  • Ability to use that new log system everywhere now
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/lib/mr_mem.c

    r3294 r3509  
    3636        *allocated = NULL;
    3737    } else {
    38         mr_msg_int(8,line,file,"Attempt to free NULL pointer");
     38        mr_msg_int(8,line,file,"mr_asprintf","Attempt to free NULL pointer");
    3939    }
    4040}
     
    4747    ret = malloc(size);
    4848    if (ret == NULL) {
    49         mr_msg_int(1,line,file,"Unable to alloc memory in mr_malloc\nExiting...");
     49        mr_msg_int(1,line,file,"mr_asprintf","Unable to alloc memory in mr_malloc\nExiting...");
    5050        mr_exit(-1,"Unable to alloc memory in mr_malloc");
    5151    }
     
    6262    res = vasprintf(strp, fmt, args);
    6363    if (res == -1) {
    64         mr_msg_int(1,line,file,"Unable to alloc memory in mr_asprintf\nExiting...");
     64        mr_msg_int(1,line,file,"mr_asprintf","Unable to alloc memory in mr_asprintf\nExiting...");
    6565        mr_exit(-1,"Unable to alloc memory in mr_asprintf");
    6666    }
     
    7676    if (*lineptr != NULL) {
    7777        /* free a variable which should be already free */
    78         mr_msg_int(1,line,file,"mr_getline_ found a non freed variable here");
     78        mr_msg_int(1,line,file,"mr_getline_int","mr_getline_ found a non freed variable here");
    7979        mr_free_int((void **)lineptr,line,file);
    8080    }
    8181    ret = getline(lineptr,&n,fd);
    8282    if ((ret == -1) && (! feof(fd))) {
    83         mr_msg_int(1,line,file,"Unable to alloc memory in mr_getline\nExiting...");
     83        mr_msg_int(1,line,file,"mr_getline_int","Unable to alloc memory in mr_getline\nExiting...");
    8484        mr_exit(-1,"Unable to alloc memory in mr_getline");
    8585    }
     
    109109   
    110110    if (name == NULL) {
    111         mr_msg_int(1,line,file,"Unable to setenv a NULL variable\nExiting...");
     111        mr_msg_int(1,line,file,"mr_setenv_int","Unable to setenv a NULL variable\nExiting...");
    112112        mr_exit(-1, "Unable to setenv a NULL variable");
    113113    }
    114114    if (value == NULL) {
    115         mr_msg_int(1,line,file,"Unable to affect NULL to %s\nExiting...", name);
     115        mr_msg_int(1,line,file,"mr_setenv_int","Unable to affect NULL to %s\nExiting...", name);
    116116        mr_exit(-1, "Unable to affect a NULL variable");
    117117    }
    118118    if (setenv(name, value, 1) != 0) {
    119         mr_msg_int(1,line,file,"Unable to put %s in environment", name);
     119        mr_msg_int(1,line,file,"mr_setenv_int","Unable to put %s in environment", name);
    120120        mr_exit(-1,"Unable to put in environment");
    121121    }
     
    136136    }
    137137    if (in == NULL) {
    138         mr_msg_int(1,line,file,"Unable to add to NULL pointer\nExiting...");
     138        mr_msg_int(1,line,file,"mr_strcat_int","Unable to add to NULL pointer\nExiting...");
    139139        mr_exit(-1, "Unable to add to a NULL pointer");
    140140    }
     
    143143        res = vasprintf(in, fmt, args);
    144144        if (res == -1) {
    145             mr_msg_int(1,line,file,"Unable to alloc memory in mr_strcat\nExiting...");
     145            mr_msg_int(1,line,file,"mr_strcat_int","Unable to alloc memory in mr_strcat\nExiting...");
    146146            mr_exit(-1,"Unable to alloc memory in mr_strcat");
    147147        }
     
    151151        res = vasprintf(in, fmt2, args);
    152152        if (res == -1) {
    153             mr_msg_int(1,line,file,"Unable to alloc memory in mr_strcat\nExiting...");
     153            mr_msg_int(1,line,file,"mr_strcat_int","Unable to alloc memory in mr_strcat\nExiting...");
    154154            mr_exit(-1,"Unable to alloc memory in mr_strcat");
    155155        }
Note: See TracChangeset for help on using the changeset viewer.