From 31369c210107f1c35e63c80ca58ed1a3493669d8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 31 May 2025 07:36:44 -0400 Subject: [PATCH] more free_nhfile() will already call init_nhfile() --- util/sfctool.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/util/sfctool.c b/util/sfctool.c index f568a793f..f87976381 100644 --- a/util/sfctool.c +++ b/util/sfctool.c @@ -80,12 +80,17 @@ static int length_without_val(const char *user_string, int len); static void usage(int argc, char **argv); static const char *briefname(const char *fnam); -void init_nhfile(NHFILE *); -NHFILE *new_nhfile(void); -void free_nhfile(NHFILE *); -void my_close_nhfile(NHFILE *); +extern void init_nhfile(NHFILE *); /* files.c */ +extern NHFILE *new_nhfile(void); /* files.c */ +extern void free_nhfile(NHFILE *); /* files.c */ + +/* + * This is a replacement tempered down version of same-named + * function in files.c within #ifndef SFCTOOL blocks. + */ int delete_savefile(void); -int nhclose(int fd); + +// int nhclose(int fd); int util_strncmpi(const char *s1, const char *s2, size_t sz); #ifdef UNIX @@ -462,7 +467,6 @@ open_srcfile(const char *fnam, enum saveformats mystyle) if (nhfp && nhfp->structlevel) { fd = open(fq_name, O_RDONLY | O_BINARY, 0); if (fd < 0) { - init_nhfile(nhfp); free_nhfile(nhfp); fprintf(stderr, "\nsfctool error - unable to open historical-style " @@ -482,7 +486,6 @@ open_srcfile(const char *fnam, enum saveformats mystyle) nhfp->fpdef = fopen(fnam, RDBMODE); if (!nhfp->fpdef) { - init_nhfile(nhfp); free_nhfile(nhfp); fprintf(stderr, "\nsfctool error - unable to open fieldlevel-style " @@ -577,7 +580,6 @@ create_dstfile(char *fnam, enum saveformats mystyle) fd = creat(dstfnam, FCMASK); #endif if (fd < 0) { - init_nhfile(nhfp); free_nhfile(nhfp); fprintf( stderr, @@ -594,7 +596,6 @@ create_dstfile(char *fnam, enum saveformats mystyle) fq_name = fqname(dstfnam, SAVEPREFIX, 0); nhfp->fpdef = fopen(fq_name, WRBMODE); if (!nhfp->fpdef) { - init_nhfile(nhfp); free_nhfile(nhfp); fprintf( stderr,