X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fcommon%2Freadwrite.c;h=ac7b56acad990ac6763d0022fd4e0c37cd99c34a;hb=c31d3a8d3f993a2cfcc8c5e438283e3a693d5b27;hp=f05c1285a9d5cdda58ee909d4814aea019318b03;hpb=62468680a5243aa9786f4f34383a2f3e33616917;p=plomrogue diff --git a/src/common/readwrite.c b/src/common/readwrite.c index f05c128..ac7b56a 100644 --- a/src/common/readwrite.c +++ b/src/common/readwrite.c @@ -14,23 +14,6 @@ -/* Return "path" + suffix "_tmp". Value is malloc'd, must be free externally. */ -static char * build_temp_path(char * path); - - - -static char * build_temp_path(char * path) -{ - char * suffix_tmp = "_tmp"; - uint16_t size = strlen(path) + strlen(suffix_tmp) + 1; - char * path_tmp = try_malloc(size, __func__); - int test = sprintf(path_tmp, "%s%s", path, suffix_tmp); - exit_trouble(test < 0, __func__, "sprintf"); - return path_tmp; -} - - - extern FILE * try_fopen(char * path, char * mode, const char * f) { char * msg1 = "Trouble in "; @@ -91,6 +74,18 @@ extern char * try_fgets(char * line, int linemax, FILE * file, const char * f) +extern char * build_temp_path(char * path) +{ + char * suffix_tmp = "_tmp"; + uint16_t size = strlen(path) + strlen(suffix_tmp) + 1; + char * path_tmp = try_malloc(size, __func__); + int test = sprintf(path_tmp, "%s%s", path, suffix_tmp); + exit_trouble(test < 0, __func__, "sprintf"); + return path_tmp; +} + + + extern FILE * atomic_write_start(char * path, char ** path_tmp) { *path_tmp = build_temp_path(path);