From 53ae53905da680c632005825ad7b046521e8c1ec Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 9 Jun 2023 08:12:03 -0700 Subject: Minor cleanup of H5detect.c (#3081) * Clean up H5detect.c * Whitespace cleanup * Align things a bit better * Comment changes --- src/H5detect.c | 267 +++++++++++++++++++++++++-------------------------------- 1 file changed, 115 insertions(+), 152 deletions(-) diff --git a/src/H5detect.c b/src/H5detect.c index 0f3be9c..8fb3887 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -10,7 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*keep this declaration near the top of this file -RPM*/ +/* Keep this declaration near the top of this file */ static const char *FileHeader = "\n\ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\ * Copyright by The HDF Group. *\n\ @@ -22,28 +22,25 @@ static const char *FileHeader = "\n\ * distribution tree, or in https://www.hdfgroup.org/licenses. *\n\ * If you do not have access to either file, you may request a copy from *\n\ * help@hdfgroup.org. *\n\ - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"; /* - * Purpose: This code was borrowed heavily from the `detect.c' - * program in the AIO distribution from Lawrence - * Livermore National Laboratory. + * Purpose: This code was borrowed heavily from the `detect.c' + * program in the AIO distribution from Lawrence + * Livermore National Laboratory. * - * Detects machine byte order and floating point - * format and generates a C source file (H5Tinit.c) - * to describe those parameters. + * Detects machine byte order and floating point + * format and generates a C source file (H5Tinit.c) + * to describe those parameters. * * Assumptions: We have an ANSI compiler. We're on a Unix like - * system or configure has detected those Unix - * features which aren't available. We're not - * running on a Vax or other machine with mixed - * endianness. + * system or configure has detected those Unix + * features which aren't available. We're not + * running on a Vax or other machine with mixed + * endianness. *------------------------------------------------------------------------- */ #undef NDEBUG #include "H5private.h" -/* Do NOT use HDfprintf in this file as it is not linked with the library, - * which contains the H5system.c file in which the function is defined. - */ #include "H5Tpublic.h" #include "H5Rpublic.h" @@ -59,10 +56,7 @@ static const char *FileHeader = "\n\ #define MAXDETECT 64 -/* - * This structure holds information about a type that - * was detected. - */ +/* This structure holds information about a type that was detected */ typedef struct detected_t { const char *varname; unsigned int size; /* total byte size */ @@ -79,7 +73,7 @@ typedef struct detected_t { FILE *rawoutstream = NULL; -/* global variables types detection code */ +/* Global variables types detection code */ H5_GCC_DIAG_OFF("larger-than=") static detected_t d_g[MAXDETECT]; H5_GCC_DIAG_ON("larger-than=") @@ -100,7 +94,7 @@ static void detect_C99_floats(void); /*------------------------------------------------------------------------- * Function: precision * - * Purpose: Determine the precision and offset. + * Purpose: Determine the precision and offset * * Return: void *------------------------------------------------------------------------- @@ -132,12 +126,12 @@ precision(detected_t *d) int _i, _j, _last = (-1); \ const char *_mesg; \ \ - HDmemset(&INFO, 0, sizeof(INFO)); \ + memset(&INFO, 0, sizeof(INFO)); \ INFO.varname = #VAR; \ INFO.size = sizeof(TYPE); \ \ /* Initialize padding mask */ \ - HDmemset(_pad_mask, 0, sizeof(_pad_mask)); \ + memset(_pad_mask, 0, sizeof(_pad_mask)); \ \ /* Padding bits. Set a variable to 4.0, then flip each bit and see if \ * the modified variable is equal ("==") to the original. Build a \ @@ -147,25 +141,25 @@ precision(detected_t *d) * and interfere with detection of the various properties below unless we \ * know to ignore them. */ \ _v1 = (TYPE)4.0L; \ - HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ + memcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ for (_i = 0; _i < (int)sizeof(TYPE); _i++) \ for (_byte_mask = (unsigned char)1; _byte_mask; _byte_mask = (unsigned char)(_byte_mask << 1)) { \ _buf1[_i] ^= _byte_mask; \ - HDmemcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \ + memcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \ H5_GCC_CLANG_DIAG_OFF("float-equal") \ if (_v1 != _v2) \ _pad_mask[_i] |= _byte_mask; \ H5_GCC_CLANG_DIAG_ON("float-equal") \ _buf1[_i] ^= _byte_mask; \ - } /* end for */ \ + } \ \ /* Byte Order */ \ for (_i = 0, _v1 = (TYPE)0.0L, _v2 = (TYPE)1.0L; _i < (int)sizeof(TYPE); _i++) { \ _v3 = _v1; \ _v1 += _v2; \ _v2 /= (TYPE)256.0L; \ - HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ - HDmemcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ + memcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ + memcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ _j = byte_cmp(sizeof(TYPE), _buf3, _buf1, _pad_mask); \ if (_j >= 0) { \ INFO.perm[_i] = _j; \ @@ -174,7 +168,7 @@ precision(detected_t *d) } \ fix_order(sizeof(TYPE), _last, INFO.perm, (const char **)&_mesg); \ \ - if (!HDstrcmp(_mesg, "VAX")) \ + if (!strcmp(_mesg, "VAX")) \ INFO.is_vax = TRUE; \ \ /* Implicit mantissa bit */ \ @@ -203,8 +197,8 @@ precision(detected_t *d) _v1 = (TYPE)1.0L; \ INFO.bias = find_bias(INFO.epos, INFO.esize, INFO.perm, &_v1); \ precision(&(INFO)); \ - if (!HDstrcmp(INFO.varname, "FLOAT") || !HDstrcmp(INFO.varname, "DOUBLE") || \ - !HDstrcmp(INFO.varname, "LDOUBLE")) { \ + if (!strcmp(INFO.varname, "FLOAT") || !strcmp(INFO.varname, "DOUBLE") || \ + !strcmp(INFO.varname, "LDOUBLE")) { \ COMP_ALIGNMENT(TYPE, INFO.comp_align); \ } \ } @@ -231,7 +225,7 @@ precision(detected_t *d) static void print_results(int nd, detected_t *d) { - int byte_order = 0; /*byte order of data types*/ + int byte_order = 0; /* byte order of data types */ int i, j; /* Include files */ @@ -246,11 +240,11 @@ print_results(int nd, detected_t *d) /***********/\n\ /* Headers */\n\ /***********/\n\ -#include \"H5private.h\" /* Generic Functions */\n\ -#include \"H5Eprivate.h\" /* Error handling */\n\ -#include \"H5FLprivate.h\" /* Free Lists */\n\ -#include \"H5Iprivate.h\" /* IDs */\n\ -#include \"H5Tpkg.h\" /* Datatypes */\n\ +#include \"H5private.h\" /* Generic Functions */\n\ +#include \"H5Eprivate.h\" /* Error handling */\n\ +#include \"H5FLprivate.h\" /* Free Lists */\n\ +#include \"H5Iprivate.h\" /* IDs */\n\ +#include \"H5Tpkg.h\" /* Datatypes */\n\ \n\ \n\ /****************/\n\ @@ -296,19 +290,15 @@ print_results(int nd, detected_t *d) /* The interface initialization function */ fprintf(rawoutstream, "\n\ - \n\ +\n\ /*-------------------------------------------------------------------------\n\ * Function: H5T__init_native\n\ *\n\ - * Purpose: Initialize pre-defined native datatypes from code generated\n\ - * during the library configuration by H5detect.\n\ - *\n\ - * Return: Success: non-negative\n\ - * Failure: negative\n\ - *\n\ - * Programmer: Robb Matzke\n\ - * Wednesday, December 16, 1998\n\ + * Purpose: Initialize pre-defined native datatypes from code generated\n\ + * during the library configuration by H5detect\n\ *\n\ + * Return: Success: non-negative\n\ + * Failure: negative\n\ *-------------------------------------------------------------------------\n\ */\n\ herr_t\n\ @@ -325,11 +315,11 @@ H5T__init_native(void)\n\ * are always zero. This happens on the Cray for `short' where * sizeof(short) is 8, but only the low-order 4 bytes are ever used. */ - if (d[i].is_vax) /* the type is a VAX floating number */ + if (d[i].is_vax) /* The type is a VAX floating number */ byte_order = -1; else { for (j = 0; j < 32; j++) { - /*Find the 1st containing valid data*/ + /* Find the 1st containing valid data */ if (d[i].perm[j] > -1) { byte_order = d[i].perm[j]; break; @@ -338,9 +328,9 @@ H5T__init_native(void)\n\ } /* Print a comment to describe this section of definitions. */ - fprintf(rawoutstream, "\n /*\n"); + fprintf(rawoutstream, "\n /*\n"); iprint(d + i); - fprintf(rawoutstream, " */\n"); + fprintf(rawoutstream, " */\n"); /* The part common to fixed and floating types */ fprintf(rawoutstream, "\ @@ -349,7 +339,7 @@ H5T__init_native(void)\n\ dt->shared->state = H5T_STATE_IMMUTABLE;\n\ dt->shared->type = H5T_FLOAT;\n\ dt->shared->size = %d;\n", - d[i].size); /*size */ + d[i].size); /* Size */ if (byte_order == -1) fprintf(rawoutstream, "\ @@ -366,27 +356,26 @@ H5T__init_native(void)\n\ dt->shared->u.atomic.prec = %d;\n\ dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\ dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;\n", - d[i].offset, /*offset */ - d[i].precision); /*precision */ - /*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */ + d[i].offset, /* Offset */ + d[i].precision); /* Precision */ /* The part unique to floating point types */ fprintf(rawoutstream, "\ -dt->shared->u.atomic.u.f.sign = %d;\n\ -dt->shared->u.atomic.u.f.epos = %d;\n\ -dt->shared->u.atomic.u.f.esize = %d;\n\ -dt->shared->u.atomic.u.f.ebias = 0x%08lx;\n\ -dt->shared->u.atomic.u.f.mpos = %d;\n\ -dt->shared->u.atomic.u.f.msize = %d;\n\ -dt->shared->u.atomic.u.f.norm = H5T_NORM_%s;\n\ -dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;\n", - d[i].sign, /*sign location */ - d[i].epos, /*exponent loc */ - d[i].esize, /*exponent size */ - (unsigned long)(d[i].bias), /*exponent bias */ - d[i].mpos, /*mantissa loc */ - d[i].msize, /*mantissa size */ - d[i].imp ? "IMPLIED" : "NONE"); /*normalization */ + dt->shared->u.atomic.u.f.sign = %d;\n\ + dt->shared->u.atomic.u.f.epos = %d;\n\ + dt->shared->u.atomic.u.f.esize = %d;\n\ + dt->shared->u.atomic.u.f.ebias = 0x%08lx;\n\ + dt->shared->u.atomic.u.f.mpos = %d;\n\ + dt->shared->u.atomic.u.f.msize = %d;\n\ + dt->shared->u.atomic.u.f.norm = H5T_NORM_%s;\n\ + dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;\n", + d[i].sign, /* Sign location */ + d[i].epos, /* Exponent loc */ + d[i].esize, /* Exponent size */ + (unsigned long)(d[i].bias), /* Exponent bias */ + d[i].mpos, /* Mantissa loc */ + d[i].msize, /* Mantissa size */ + d[i].imp ? "IMPLIED" : "NONE"); /* Normalization */ /* Register the type */ fprintf(rawoutstream, "\ @@ -395,10 +384,10 @@ dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;\n", d[i].varname); /* Variables for alignment of compound datatype */ - if (!HDstrcmp(d[i].varname, "SCHAR") || !HDstrcmp(d[i].varname, "SHORT") || - !HDstrcmp(d[i].varname, "INT") || !HDstrcmp(d[i].varname, "LONG") || - !HDstrcmp(d[i].varname, "LLONG") || !HDstrcmp(d[i].varname, "FLOAT") || - !HDstrcmp(d[i].varname, "DOUBLE") || !HDstrcmp(d[i].varname, "LDOUBLE")) { + if (!strcmp(d[i].varname, "SCHAR") || !strcmp(d[i].varname, "SHORT") || + !strcmp(d[i].varname, "INT") || !strcmp(d[i].varname, "LONG") || !strcmp(d[i].varname, "LLONG") || + !strcmp(d[i].varname, "FLOAT") || !strcmp(d[i].varname, "DOUBLE") || + !strcmp(d[i].varname, "LDOUBLE")) { fprintf(rawoutstream, " H5T_NATIVE_%s_ALIGN_g = %lu;\n", d[i].varname, (unsigned long)(d[i].comp_align)); } @@ -425,8 +414,8 @@ done:\n\ if(dt != NULL) {\n\ dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);\n\ dt = H5FL_FREE(H5T_t, dt);\n\ - } /* end if */\n\ - } /* end if */\n\ + }\n\ + }\n\ \n\ FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5T__init_native() */\n"); @@ -435,10 +424,9 @@ done:\n\ /*------------------------------------------------------------------------- * Function: iprint * - * Purpose: Prints information about the fields of a floating point format. + * Purpose: Prints information about the fields of a floating point format * * Return: void - *------------------------------------------------------------------------- */ static void @@ -448,55 +436,50 @@ iprint(detected_t *d) for (pass = (d->size - 1) / 4;; --pass) { unsigned int i, k; - /* - * Print the byte ordering above the bit fields. - */ - fprintf(rawoutstream, " * "); + + /* Print the byte ordering above the bit fields */ + fprintf(rawoutstream, " * "); for (i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { fprintf(rawoutstream, "%4d", d->perm[i]); if (i > pass * 4) - HDfputs(" ", rawoutstream); + fputs(" ", rawoutstream); if (!i) break; } - /* - * Print the bit fields - */ - fprintf(rawoutstream, "\n * "); + /* Print the bit fields */ + fprintf(rawoutstream, "\n * "); for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, 8 * d->size - 1); i >= pass * 4; --i) { unsigned int j; for (j = 8; j > 0; --j) { if (k == d->sign) { - HDfputc('S', rawoutstream); + fputc('S', rawoutstream); } else if (k >= d->epos && k < d->epos + d->esize) { - HDfputc('E', rawoutstream); + fputc('E', rawoutstream); } else if (k >= d->mpos && k < d->mpos + d->msize) { - HDfputc('M', rawoutstream); + fputc('M', rawoutstream); } else { - HDfputc('?', rawoutstream); /*unknown floating point bit */ + fputc('?', rawoutstream); /* Unknown floating point bit */ } --k; } if (i > pass * 4) - HDfputc(' ', rawoutstream); + fputc(' ', rawoutstream); if (!i) break; } - HDfputc('\n', rawoutstream); + fputc('\n', rawoutstream); if (!pass) break; } - /* - * Is there an implicit bit in the mantissa. - */ - fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); + /* Is there an implicit bit in the mantissa? */ + fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); } /*------------------------------------------------------------------------- @@ -535,7 +518,6 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) * the corresponding bit in pad_mask is set to 0. * * Return: Index of first differing bit. - * *------------------------------------------------------------------------- */ static unsigned int @@ -547,7 +529,7 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, const unsigned char unsigned char aa, bb; for (i = 0; i < nbytes; i++) { - HDassert(perm[i] < (int)nbytes); + assert(perm[i] < (int)nbytes); if ((aa = (unsigned char)(a[perm[i]] & pad_mask[perm[i]])) != (bb = (unsigned char)(b[perm[i]] & pad_mask[perm[i]]))) { unsigned int j; @@ -557,11 +539,11 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, const unsigned char return i * 8 + j; } fprintf(stderr, "INTERNAL ERROR"); - HDabort(); + abort(); } } fprintf(stderr, "INTERNAL ERROR"); - HDabort(); + abort(); return 0; } @@ -585,35 +567,28 @@ fix_order(int n, int last, int *perm, const char **mesg) int i; if (last > 1) { - /* - * We have at least three points to consider. - */ + + /* We have at least three points to consider */ if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { - /* - * Little endian. - */ + /* Little endian */ if (mesg) *mesg = "Little-endian"; for (i = 0; i < n; i++) perm[i] = i; } else if (perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) { - /* - * Big endian. - */ + /* Big endian */ if (mesg) *mesg = "Big-endian"; for (i = 0; i < n; i++) perm[i] = (n - 1) - i; } else { - /* - * Bi-endian machines like VAX. + /* Bi-endian machines like VAX * (NOTE: This is not an actual determination of the VAX-endianness. - * It could have some other endianness and fall into this - * case - JKM & QAK) + * It could have some other endianness and fall into this case. */ - HDassert(0 == n % 2); + assert(0 == n % 2); if (mesg) *mesg = "VAX"; for (i = 0; i < n; i += 2) { @@ -624,7 +599,7 @@ fix_order(int n, int last, int *perm, const char **mesg) } else { fprintf(stderr, "Failed to detect byte order of %d-byte floating point.\n", n); - HDexit(1); + exit(EXIT_FAILURE); } } @@ -652,7 +627,6 @@ fix_order(int n, int last, int *perm, const char **mesg) * returns zero. * * Failure: 1 - * *------------------------------------------------------------------------- */ static unsigned int @@ -661,16 +635,14 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ unsigned char *a = (unsigned char *)_a; unsigned char *b = (unsigned char *)_b; unsigned int changed, major, minor; - unsigned int msmb; /* most significant mantissa bit */ + unsigned int msmb; /* Most significant mantissa bit */ - /* - * Look for the least significant bit that has changed between + /* Look for the least significant bit that has changed between * A and B. This is the least significant bit of the exponent. */ changed = bit_cmp(n, perm, a, b, pad_mask); - /* - * The bit to the right (less significant) of the changed bit should + /* The bit to the right (less significant) of the changed bit should * be the most significant bit of the mantissa. If it is non-zero * then the format does not remove the leading `1' of the mantissa. */ @@ -687,8 +659,7 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ * Purpose: Determines the bias of the exponent. This function should * be called with _A having a value of `1'. * - * Return: The exponent bias. - * + * Return: The exponent bias *------------------------------------------------------------------------- */ H5_ATTR_PURE static unsigned int @@ -722,9 +693,8 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) static void print_header(void) { - - time_t now = HDtime(NULL); - struct tm *tm = HDlocaltime(&now); + time_t now = time(NULL); + struct tm *tm = localtime(&now); char real_name[30]; char host_name[256]; int i; @@ -774,21 +744,19 @@ the radix point is still assumed to be\n\ before the first `M' but after the implicit\n\ bit.\n"; - /* - * The real name is the first item from the passwd gecos field. - */ + /* The real name is the first item from the passwd gecos field */ #ifdef H5_HAVE_GETPWUID { size_t n; char *comma; - if ((pwd = HDgetpwuid(HDgetuid()))) { - if ((comma = HDstrchr(pwd->pw_gecos, ','))) { + if ((pwd = getpwuid(getuid()))) { + if ((comma = strchr(pwd->pw_gecos, ','))) { n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); - HDstrncpy(real_name, pwd->pw_gecos, n); + strncpy(real_name, pwd->pw_gecos, n); real_name[n] = '\0'; } else { - HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + strncpy(real_name, pwd->pw_gecos, sizeof(real_name)); real_name[sizeof(real_name) - 1] = '\0'; } } @@ -799,22 +767,18 @@ bit.\n"; real_name[0] = '\0'; #endif - /* - * The FQDM of this host or the empty string. - */ + /* The FQDM of this host or the empty string */ #ifdef H5_HAVE_GETHOSTNAME - if (HDgethostname(host_name, sizeof(host_name)) < 0) { + if (gethostname(host_name, sizeof(host_name)) < 0) { host_name[0] = '\0'; } #else host_name[0] = '\0'; #endif - /* - * The file header: warning, copyright notice, build information. - */ - fprintf(rawoutstream, "/* Generated automatically by H5detect -- do not edit */\n\n\n"); - HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ + /* The file header: warning, copyright notice, build information */ + fprintf(rawoutstream, "/* Generated automatically by H5detect -- DO NOT EDIT! */\n\n\n"); + fputs(FileHeader, rawoutstream); /* The copyright notice -- see top of this file */ fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); @@ -824,17 +788,17 @@ bit.\n"; fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID if (pwd) - HDfputs(pwd->pw_name, rawoutstream); + fputs(pwd->pw_name, rawoutstream); #endif if (host_name[0]) fprintf(rawoutstream, "@%s", host_name); if (real_name[0]) fprintf(rawoutstream, ">"); - HDfputc('\n', rawoutstream); + fputc('\n', rawoutstream); } fprintf(rawoutstream, " *\n * Purpose:\t\t"); for (s = purpose; *s; s++) { - HDfputc(*s, rawoutstream); + fputc(*s, rawoutstream); if ('\n' == *s && s[1]) fprintf(rawoutstream, " *\t\t\t"); } @@ -845,7 +809,7 @@ bit.\n"; fprintf(rawoutstream, " *\n *"); for (i = 0; i < 73; i++) - HDfputc('-', rawoutstream); + fputc('-', rawoutstream); fprintf(rawoutstream, "\n */\n\n"); } @@ -895,9 +859,9 @@ detect_C99_floats(void) /*------------------------------------------------------------------------- * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point * - * Return: Success: EXIT_SUCCESS + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ @@ -905,7 +869,7 @@ int HDF_NO_UBSAN main(int argc, char *argv[]) { char *fname = NULL; - FILE *f; /* temporary holding place for the stream pointer + FILE *f; /* Temporary holding place for the stream pointer * so that rawoutstream is changed only when succeeded */ if (argc > 1) @@ -913,8 +877,7 @@ main(int argc, char *argv[]) /* First check if filename is string "NULL" */ if (fname != NULL) { - /* binary output */ - if ((f = HDfopen(fname, "w")) != NULL) + if ((f = fopen(fname, "w")) != NULL) rawoutstream = f; } if (!rawoutstream) @@ -931,7 +894,7 @@ main(int argc, char *argv[]) print_results(nd_g, d_g); if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) + if (fclose(rawoutstream)) fprintf(stderr, "closing rawoutstream"); else rawoutstream = NULL; -- cgit v0.12