Ignore:
Timestamp:
Aug 18, 2009, 3:13:54 PM (11 years ago)
Author:
Bruno Cornec
Message:

r3335@localhost: bruno | 2009-08-08 23:04:12 +0200

  • Change mr_asprintf to avoid the need of pointer and be consistent with the other mr_mem functions
File:
1 edited

Legend:

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

    r2323 r2324  
    10121012{
    10131013    /*@ buffers ***************************************************** */
    1014     char *tmp = NULL;
    10151014    char *datablock;
    10161015    char *temp_fname;
    10171016    char *temp_cksum;
    10181017    char *actual_cksum = NULL;
    1019 //  char *pA, *pB;
    10201018
    10211019    /*@ int ********************************************************* */
     
    10581056    res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    10591057    if (orig_size != temp_size && orig_size != -1) {
    1060         mr_asprintf(tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
    1061         log_to_screen(tmp);
    1062         mr_free(tmp);
     1058        log_to_screen("output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
    10631059    }
    10641060    if (ctrl_chr != BLK_START_FILE) {
     
    11311127    }
    11321128    if (strcmp(temp_cksum, actual_cksum)) {
    1133         mr_asprintf(tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
    1134         log_to_screen(tmp);
    1135         mr_free(tmp);
    1136 
    1137         mr_asprintf(tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
    1138         log_to_screen(tmp);
    1139         mr_free(tmp);
    1140 
     1129        log_to_screen("actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
     1130        log_to_screen("%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
    11411131        retval++;
    11421132    }
     
    15731563    /*@ pointers *************************************************** */
    15741564    FILE *fin;
    1575     char *tmp = NULL;
    15761565
    15771566    /*@ long ******************************************************* */
     
    15911580    log_it("Data disks = %s", fname);
    15921581    if (!does_file_exist(fname)) {
    1593         mr_asprintf(tmp, "Cannot find %s", fname);
    1594         log_to_screen(tmp);
    1595         mr_free(tmp);
     1582        log_to_screen("Cannot find %s", fname);
    15961583        return (1);
    15971584    }
     
    16361623{
    16371624    /*@ buffers **************************************************** */
    1638     char *tmp = NULL;
    16391625    char datablock[TAPE_BLOCK_SIZE];
    16401626    char *checksum = NULL;
     
    16891675        p++;
    16901676    }
    1691     mr_asprintf(tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
    1692     log_it(tmp);
    1693     mr_free(tmp);
     1677    log_it("Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
    16941678    write_header_block_to_stream(filesize, infile_basename,
    16951679                                 BLK_START_FILE);
     
    17611745    /*@ buffers **************************************************** */
    17621746    char tempblock[TAPE_BLOCK_SIZE];
    1763     char *tmp = NULL;
    17641747    char *p;
    17651748
     
    17801763    }
    17811764    if (!g_tape_stream) {
    1782         log_to_screen
    1783             ("You're not backing up to tape. Why write a tape header?");
     1765        log_to_screen("You're not backing up to tape. Why write a tape header?");
    17841766        return (1);
    17851767    }
     
    17911773    memcpy(tempblock + 7001, (char *) &olen, sizeof(off_t));
    17921774    strcpy(tempblock + 1000, filename);
    1793     g_tape_posK +=
    1794         fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
    1795                g_tape_stream) / 1024;
    1796     mr_asprintf(tmp, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10);
    1797     log_msg(6, tmp);
    1798     mr_free(tmp);
     1775    g_tape_posK += fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream) / 1024;
     1776    log_msg(6, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10);
    17991777    return (0);
    18001778}
     
    18161794void wrong_marker(int should_be, int it_is)
    18171795{
    1818     /*@ buffer ***************************************************** */
    1819     char *tmp = NULL;
    1820 
    1821 
    1822     /*@ end vars *************************************************** */
    1823     mr_asprintf(tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
    1824     log_to_screen(tmp);
    1825     mr_free(tmp);
     1796    log_to_screen("Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
    18261797}
    18271798
Note: See TracChangeset for help on using the changeset viewer.