Changeset 2414


Ignore:
Timestamp:
Sep 20, 2009, 2:53:32 AM (10 years ago)
Author:
bruno
Message:

severity_of_difference is now allocating memory freed by the caller

Location:
branches/2.2.10/mondo/src/common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-string-EXT.h

    r2413 r2414  
    2929
    3030extern int compare_two_filelist_entries(void *va, void *vb);
    31 extern int severity_of_difference(char *filename, char *out_reason);
     31extern int severity_of_difference(char *filename, char **out_reason);
    3232
    3333extern char *percent_media_full_comment();
  • branches/2.2.10/mondo/src/common/libmondo-string.c

    r2413 r2414  
    851851 * @return The severity (1-3).
    852852 */
    853 int severity_of_difference(char *fn, char *out_reason) {
    854 
    855     int sev;
     853int severity_of_difference(char *fn, char **out_reason) {
     854
     855    int sev = 3;
    856856    char *reason = NULL;
    857857    char *filename = NULL;
     
    867867    }
    868868
    869     sev = 3;
    870869    mr_asprintf(reason, "Changed since backup. Consider running a differential backup in a day or two.");
    871870
     
    956955        mr_asprintf(reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");
    957956    }
    958     if (out_reason) {
    959         strcpy(out_reason, reason);
     957
     958    if (reason != NULL) {
     959        *out_reason = reason;
    960960    }
    961961    mr_free(filename);
    962     mr_free(reason);
    963962    return (sev);
    964963}
  • branches/2.2.10/mondo/src/common/libmondo-string.h

    r2413 r2414  
    2626
    2727int compare_two_filelist_entries(void *va, void *vb);
    28 int severity_of_difference(char *filename, char *out_reason);
     28int severity_of_difference(char *filename, char **out_reason);
    2929
    3030char *percent_media_full_comment();
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2382 r2414  
    14011401void popup_changelist_from_file(char *source_file) {
    14021402
    1403         char *reason;
     1403        char *reason = NULL;
    14041404        newtComponent myForm;
    14051405        newtComponent bClose;
     
    14721472        newtFormAddComponents(myForm, headerMsg, fileListbox, bClose, bSelect, NULL);
    14731473
    1474         malloc_string(reason);
    14751474        while (!finished) {
    14761475            b_res = newtRunForm(myForm);
     
    14871486                    currline = i;
    14881487                    if (filelist->entries > 0) {
    1489                         severity_of_difference(filelist->el[currline].  filename, reason);
     1488                        severity_of_difference(filelist->el[currline].  filename, &reason);
    14901489                        mr_asprintf(tmp, "%s --- %s", filelist->el[currline].filename, reason);
    14911490
    14921491                        popup_and_OK(tmp);
    14931492                        mr_free(tmp);
     1493                        mr_free(reason);
    14941494                    }
    14951495                }
    14961496            }
    14971497        }
    1498         paranoid_free(reason);
    14991498
    15001499        newtFormDestroy(myForm);
Note: See TracChangeset for help on using the changeset viewer.