Ignore:
Timestamp:
Aug 29, 2009, 12:56:50 AM (10 years ago)
Author:
bruno
Message:

Remove function spread_flaws_across_three_lines and expand it at the single place where it was useful, and fix memory allocation issues in it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-string.c

    r2350 r2355  
    598598    return ('.');
    599599}
    600 
    601 
    602 
    603 
    604 /**
    605  * Wrap @p flaws_str across three lines. The first two are no more than 74 characters wide.
    606  * @param flaws_str The original string to split.
    607  * @param flaws_str_A Where to put the first 74-or-less characters.
    608  * @param flaws_str_B Where to put the second 74-or-less characters.
    609  * @param flaws_str_C Where to put the rest.
    610  */
    611 void
    612 spread_flaws_across_three_lines(char *flaws_str, char *flaws_str_A,
    613                                 char *flaws_str_B, char *flaws_str_C)
    614 {
    615 
    616     /*@ int ************************************************************* */
    617     int i = 0;
    618 
    619     /*@ initialize ****************************************************** */
    620     assert(flaws_str != NULL);
    621 
    622     if (strlen(flaws_str) > 0) {
    623         mr_asprintf(&flaws_str_A, "%s", flaws_str + 1);
    624     }
    625     if (strlen(flaws_str_A) >= 74) {
    626         for (i = 74; flaws_str_A[i] != ' '; i--);
    627         mr_asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1);
    628         flaws_str_A[i] = '\0';
    629     }
    630     if (strlen(flaws_str_B) >= 74) {
    631         for (i = 74; flaws_str_B[i] != ' '; i--);
    632         mr_asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1);
    633         flaws_str_B[i] = '\0';
    634     }
    635 }
    636 
    637600
    638601
Note: See TracChangeset for help on using the changeset viewer.