Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove HD from HDis* (e.g., isalpha) #3212

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/H5.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ H5__debug_mask(const char *s)

while (s && *s) {

if (HDisalpha(*s) || '-' == *s || '+' == *s) {
if (isalpha(*s) || '-' == *s || '+' == *s) {

/* Enable or Disable debugging? */
if ('-' == *s) {
Expand All @@ -712,7 +712,7 @@ H5__debug_mask(const char *s)
} /* end if */

/* Get the name */
for (i = 0; HDisalpha(*s); i++, s++)
for (i = 0; isalpha(*s); i++, s++)
if (i < sizeof pkg_name)
pkg_name[i] = *s;
pkg_name[MIN(sizeof(pkg_name) - 1, i)] = '\0';
Expand Down Expand Up @@ -744,7 +744,7 @@ H5__debug_mask(const char *s)
fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
} /* end if-else */
}
else if (HDisdigit(*s)) {
else if (isdigit(*s)) {
int fd = (int)strtol(s, &rest, 0);
H5_debug_open_stream_t *open_stream;

Expand Down Expand Up @@ -888,7 +888,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
/* Allow different versions of the header files and library? */
s = HDgetenv("HDF5_DISABLE_VERSION_CHECK");

if (s && HDisdigit(*s))
if (s && isdigit(*s))
disable_version_check = (unsigned int)strtol(s, NULL, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/H5AC.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ H5AC_init(void)
const char *s; /* String for environment variables */

s = HDgetenv("H5_COLL_API_SANITY_CHECK");
if (s && HDisdigit(*s)) {
if (s && isdigit(*s)) {
long env_val = strtol(s, NULL, 0);
H5_coll_api_sanity_check_g = (0 == env_val) ? FALSE : TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion src/H5FDmpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ H5FD_mpio_init(void)

/* Allow MPI buf-and-file-type optimizations? */
s = HDgetenv("HDF5_MPI_OPT_TYPES");
if (s && HDisdigit(*s))
if (s && isdigit(*s))
H5FD_mpi_opt_types_g = (0 == strtol(s, NULL, 0)) ? FALSE : TRUE;

#ifdef H5FDmpio_DEBUG
Expand Down
13 changes: 6 additions & 7 deletions src/H5FDs3comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha

/* "trim" tailing whitespace by replacing with null terminator*/
buffer_i = 0;
while (!HDisspace(setting_pointers[setting_i][buffer_i]))
while (!isspace(setting_pointers[setting_i][buffer_i]))
buffer_i++;
setting_pointers[setting_i][buffer_i] = '\0';

Expand Down Expand Up @@ -2242,7 +2242,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
/* check for restrictions */
for (i = 0; i < len; i++) {
/* scheme = [a-zA-Z+-.]+ (terminated by ":") */
if (!HDisalpha(curstr[i]) && '+' != curstr[i] && '-' != curstr[i] && '.' != curstr[i])
if (!isalpha(curstr[i]) && '+' != curstr[i] && '-' != curstr[i] && '.' != curstr[i])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction");
}

Expand Down Expand Up @@ -2308,7 +2308,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
else if (len > urllen)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PORT substring");
for (i = 0; i < len; i++)
if (!HDisdigit(curstr[i]))
if (!isdigit(curstr[i]))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT is not a decimal string");

/* copy port */
Expand Down Expand Up @@ -2766,7 +2766,7 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written)
/* Find first non-whitespace character from start;
* reduce total length per character.
*/
while ((s_len > 0) && HDisspace((unsigned char)s[0]) && s_len > 0) {
while ((s_len > 0) && isspace((unsigned char)s[0]) && s_len > 0) {
s++;
s_len--;
}
Expand All @@ -2778,7 +2778,7 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written)
if (s_len > 0) {
do {
s_len--;
} while (HDisspace((unsigned char)s[s_len]));
} while (isspace((unsigned char)s[s_len]));
s_len++;

/* write output into dest */
Expand Down Expand Up @@ -2858,8 +2858,7 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_s
*/
for (s_off = 0; s_off < s_len; s_off++) {
c = s[s_off];
if (HDisalnum(c) || c == '.' || c == '-' || c == '_' || c == '~' ||
(c == '/' && encode_slash == FALSE))
if (isalnum(c) || c == '.' || c == '-' || c == '_' || c == '~' || (c == '/' && encode_slash == FALSE))
dest[dest_off++] = c;
else {
hex_off = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/H5Omtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ H5O__mtime_decode(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
if (H5_IS_BUFFER_OVERFLOW(p, 16, p_end))
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
for (int i = 0; i < 14; i++)
if (!HDisdigit(p[i]))
if (!isdigit(p[i]))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")

/* Convert YYYYMMDDhhmmss UTC to a time_t. */
Expand Down
26 changes: 13 additions & 13 deletions src/H5Ztrans.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,10 @@ H5Z__get_token(H5Z_token *current)
current->tok_begin = current->tok_end;

while (current->tok_begin[0] != '\0') {
if (HDisspace(current->tok_begin[0])) {
if (isspace(current->tok_begin[0])) {
/* ignore whitespace */
}
else if (HDisdigit(current->tok_begin[0]) || current->tok_begin[0] == '.') {
else if (isdigit(current->tok_begin[0]) || current->tok_begin[0] == '.') {
current->tok_end = current->tok_begin;

/*
Expand All @@ -405,7 +405,7 @@ H5Z__get_token(H5Z_token *current)
/* is number */
current->tok_type = H5Z_XFORM_INTEGER;

while (HDisdigit(current->tok_end[0]))
while (isdigit(current->tok_end[0]))
++current->tok_end;
}

Expand All @@ -422,39 +422,39 @@ H5Z__get_token(H5Z_token *current)
if (current->tok_end[0] == '.')
do {
++current->tok_end;
} while (HDisdigit(current->tok_end[0]));
} while (isdigit(current->tok_end[0]));

if (current->tok_end[0] == 'e' || current->tok_end[0] == 'E') {
++current->tok_end;

if (current->tok_end[0] == '-' || current->tok_end[0] == '+')
++current->tok_end;

if (!HDisdigit(current->tok_end[0])) {
if (!isdigit(current->tok_end[0])) {
current->tok_type = H5Z_XFORM_ERROR;
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, current,
"Invalidly formatted floating point number")
}

while (HDisdigit(current->tok_end[0]))
while (isdigit(current->tok_end[0]))
++current->tok_end;
}

/* Check that this is a properly formatted numerical value */
if (HDisalpha(current->tok_end[0]) || current->tok_end[0] == '.') {
if (isalpha(current->tok_end[0]) || current->tok_end[0] == '.') {
current->tok_type = H5Z_XFORM_ERROR;
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, current, "Invalidly formatted floating point number")
}
}

break;
}
else if (HDisalpha(current->tok_begin[0])) {
else if (isalpha(current->tok_begin[0])) {
/* is symbol */
current->tok_type = H5Z_XFORM_SYMBOL;
current->tok_end = current->tok_begin;

while (HDisalnum(current->tok_end[0]))
while (isalnum(current->tok_end[0]))
++current->tok_end;

break;
Expand Down Expand Up @@ -1476,11 +1476,11 @@ H5Z_xform_create(const char *expr)
* A more sophisticated check is needed to support scientific notation.
*/
for (i = 0; i < HDstrlen(expr); i++) {
if (HDisalpha(expr[i])) {
if (isalpha(expr[i])) {
if ((i > 0) && (i < (HDstrlen(expr) - 1))) {
if (((expr[i] == 'E') || (expr[i] == 'e')) &&
(HDisdigit(expr[i - 1]) || (expr[i - 1] == '.')) &&
(HDisdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+')))
(isdigit(expr[i - 1]) || (expr[i - 1] == '.')) &&
(isdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+')))
continue;
} /* end if */

Expand Down Expand Up @@ -1622,7 +1622,7 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop)
/* Find the number of times "x" is used in this equation, and allocate room for storing that many
* points */
for (i = 0; i < HDstrlen(new_data_xform_prop->xform_exp); i++)
if (HDisalpha(new_data_xform_prop->xform_exp[i]))
if (isalpha(new_data_xform_prop->xform_exp[i]))
count++;

if (count > 0)
Expand Down
2 changes: 1 addition & 1 deletion src/H5dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark
else {
c = buf[buf_offset + u + v];

if (HDisprint(c))
if (isprint(c))
HDfputc(c, stream);
else
HDfputc('.', stream);
Expand Down
67 changes: 17 additions & 50 deletions src/H5private.h
Original file line number Diff line number Diff line change
Expand Up @@ -754,45 +754,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
#ifndef HDgmtime
#define HDgmtime(T) gmtime(T)
#endif
#ifndef HDisalnum
#define HDisalnum(C) isalnum((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDisalpha
#define HDisalpha(C) isalpha((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDisatty
#define HDisatty(F) isatty(F)
#endif
#ifndef HDiscntrl
#define HDiscntrl(C) iscntrl((int)(C)) /* Cast for solaris warning */
#endif
#ifndef HDisdigit
#define HDisdigit(C) isdigit((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDisgraph
#define HDisgraph(C) isgraph((int)(C)) /* Cast for Solaris warning*/
#endif
#ifndef HDislower
#define HDislower(C) islower((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDisnan
#define HDisnan(X) isnan(X)
#endif
#ifndef HDisprint
#define HDisprint(C) isprint((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDispunct
#define HDispunct(C) ispunct((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDisspace
#define HDisspace(C) isspace((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDisupper
#define HDisupper(C) isupper((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDisxdigit
#define HDisxdigit(C) isxdigit((int)(C)) /* Cast for Solaris warning */
#endif
#ifndef HDlabs
#define HDlabs(X) labs(X)
#endif
Expand Down Expand Up @@ -1210,8 +1177,8 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap);
#define H5_DIR_SEPC '\\'
#define H5_DIR_SEPS "\\"
#define H5_CHECK_DELIMITER(SS) ((SS == H5_DIR_SEPC) || (SS == H5_DIR_SLASH_SEPC))
#define H5_CHECK_ABSOLUTE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':') && (H5_CHECK_DELIMITER(NAME[2])))
#define H5_CHECK_ABS_DRIVE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':'))
#define H5_CHECK_ABSOLUTE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':') && (H5_CHECK_DELIMITER(NAME[2])))
#define H5_CHECK_ABS_DRIVE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':'))
#define H5_CHECK_ABS_PATH(NAME) (H5_CHECK_DELIMITER(NAME[0]))

#define H5_GET_LAST_DELIMITER(NAME, ptr) \
Expand Down Expand Up @@ -1449,34 +1416,34 @@ H5_DLL herr_t H5_trace_args(struct H5RS_str_t *rs, const char *type, va_list ap)
* Handles H5XY_.
*/
#define H5_IS_API(S) \
('_' != ((const char *)S)[2] /* underscore at position 2 */ \
&& '_' != ((const char *)S)[3] /* underscore at position 3 */ \
&& !( /* NOT */ \
((const char *)S)[4] /* pos 4 exists */ \
&& (HDisupper(S[3]) || HDisdigit(S[3])) /* pos 3 dig | uc */ \
&& '_' == ((const char *)S)[4] /* pos 4 underscore */ \
('_' != ((const char *)S)[2] /* underscore at position 2 */ \
&& '_' != ((const char *)S)[3] /* underscore at position 3 */ \
&& !( /* NOT */ \
((const char *)S)[4] /* pos 4 exists */ \
&& (isupper(S[3]) || isdigit(S[3])) /* pos 3 dig | uc */ \
&& '_' == ((const char *)S)[4] /* pos 4 underscore */ \
))

/* `S' is the name of a function which is being tested to check if it's */
/* a public API function */
#define H5_IS_PUB(S) \
(((HDisdigit(S[1]) || HDisupper(S[1])) && HDislower(S[2])) || \
((HDisdigit(S[2]) || HDisupper(S[2])) && HDislower(S[3])) || \
(!S[4] || ((HDisdigit(S[3]) || HDisupper(S[3])) && HDislower(S[4]))))
(((isdigit(S[1]) || isupper(S[1])) && islower(S[2])) || \
((isdigit(S[2]) || isupper(S[2])) && islower(S[3])) || \
(!S[4] || ((isdigit(S[3]) || isupper(S[3])) && islower(S[4]))))

/* `S' is the name of a function which is being tested to check if it's */
/* a private library function */
#define H5_IS_PRIV(S) \
(((HDisdigit(S[1]) || HDisupper(S[1])) && '_' == S[2] && HDislower(S[3])) || \
((HDisdigit(S[2]) || HDisupper(S[2])) && '_' == S[3] && HDislower(S[4])) || \
((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && HDislower(S[5])))
(((isdigit(S[1]) || isupper(S[1])) && '_' == S[2] && islower(S[3])) || \
((isdigit(S[2]) || isupper(S[2])) && '_' == S[3] && islower(S[4])) || \
((isdigit(S[3]) || isupper(S[3])) && '_' == S[4] && islower(S[5])))

/* `S' is the name of a function which is being tested to check if it's */
/* a package private function */
#define H5_IS_PKG(S) \
(((HDisdigit(S[1]) || HDisupper(S[1])) && '_' == S[2] && '_' == S[3] && HDislower(S[4])) || \
((HDisdigit(S[2]) || HDisupper(S[2])) && '_' == S[3] && '_' == S[4] && HDislower(S[5])) || \
((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && '_' == S[5] && HDislower(S[6])))
(((isdigit(S[1]) || isupper(S[1])) && '_' == S[2] && '_' == S[3] && islower(S[4])) || \
((isdigit(S[2]) || isupper(S[2])) && '_' == S[3] && '_' == S[4] && islower(S[5])) || \
((isdigit(S[3]) || isupper(S[3])) && '_' == S[4] && '_' == S[5] && islower(S[6])))

/* global library version information string */
extern char H5_lib_vers_info_g[];
Expand Down
4 changes: 2 additions & 2 deletions src/H5trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
asize[i] = -1;

/* Parse the argument types */
for (argno = 0; *type; argno++, type += (HDisupper(*type) ? 2 : 1)) {
for (argno = 0; *type; argno++, type += (isupper(*type) ? 2 : 1)) {
/* Count levels of indirection */
for (ptr = 0; '*' == *type; type++)
ptr++;
Expand Down Expand Up @@ -3922,7 +3922,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
break;

default:
if (HDisupper(type[0]))
if (isupper(type[0]))
H5RS_asprintf_cat(rs, "BADTYPE(%c%c)", type[0], type[1]);
else
H5RS_asprintf_cat(rs, "BADTYPE(%c)", type[0]);
Expand Down
6 changes: 3 additions & 3 deletions tools/lib/h5tools_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
H5TOOLS_START_DEBUG(" - h_list:%s", h_list);
/* count how many integers do we have */
for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
if (HDisdigit(*ptr)) {
if (isdigit(*ptr)) {
if (!last_digit)
/* the last read character wasn't a digit */
size_count++;
Expand All @@ -209,11 +209,11 @@ parse_hsize_list(const char *h_list, subset_d *d)
H5TOOLS_INFO("Unable to allocate space for subset data");

for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
if (HDisdigit(*ptr)) {
if (isdigit(*ptr)) {
/* we should have an integer now */
p_list[i++] = (hsize_t)strtoull(ptr, NULL, 0);

while (HDisdigit(*ptr))
while (isdigit(*ptr))
/* scroll to end of integer */
ptr++;
}
Expand Down
Loading