Changeset 3837 in MondoRescue for branches/3.3/mondo/src/lib


Ignore:
Timestamp:
Mar 5, 2024, 2:51:50 AM (3 months ago)
Author:
Bruno Cornec
Message:

integrates mr_allocstr_int functions not used yet into mr_asprintf_int

File:
1 edited

Legend:

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

    r3645 r3837  
    5353}
    5454
    55 /* encapsulation function for asprintf */
     55/*
     56 * Function that properly allocates a string from a format and params by encapsulating asprintf
     57 * freeing it before in any case
     58 */
    5659void mr_asprintf_int(char **strp, int line, const char *file, const char *fmt, ...) {
    5760
    5861    int res = 0;
    5962    va_list args;
     63
     64    if ((strp != NULL) && (*strp != NULL)) {
     65        mr_free_int((void **)strp, line, file);
     66    }
    6067
    6168    va_start(args,fmt);
     
    8996        mr_asprintf_int(lineptr,line,file,"");
    9097    }
    91 }
    92 
    93 /*
    94  * Function that properly allocates a string from another one
    95  * freeing it before in any case
    96  */
    97 void mr_allocstr_int(char *alloc, const char *orig, int line, const char *file) {
    98 
    99     if (alloc != NULL) {
    100         mr_free_int((void **)&alloc, line, file);
    101     }
    102     mr_asprintf_int(&alloc, line, file, orig);
    10398}
    10499
Note: See TracChangeset for help on using the changeset viewer.