Skip to content

Commit

Permalink
Merge pull request #967 from NetCDF-World-Domination-Council/ejh_streq
Browse files Browse the repository at this point in the history
changed macro STREQ to NCSTREQ to avoid name collusion with HDF4 library
  • Loading branch information
WardF authored Jun 20, 2018
2 parents 8de0b3c + 5ebb30b commit c4bf958
Show file tree
Hide file tree
Showing 9 changed files with 573 additions and 804 deletions.
6 changes: 3 additions & 3 deletions ncdump/nctime0.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool_t
is_bounds_var(char *varname, int *pargrpidp, int *parvaridp) {
bounds_node_t *bp = bounds_list.first;
for(; bp; bp = bp->next) {
if(STREQ(bp->bounds_name, varname)) {
if(NCSTREQ(bp->bounds_name, varname)) {
*pargrpidp = bp->ncid;
*parvaridp = bp->varid;
return true;
Expand Down Expand Up @@ -160,11 +160,11 @@ is_valid_time_unit(const char *units) {
/* Return true only if this is a "bounds" attribute */
bool_t
is_bounds_att(ncatt_t *attp) {
if(attp->type == NC_CHAR && attp->valgp && STREQ((char *)attp->name, "bounds")) {
if(attp->type == NC_CHAR && attp->valgp && NCSTREQ((char *)attp->name, "bounds")) {
return true;
}
#ifdef USE_NETCDF4
if(attp->type == NC_STRING && attp->valgp && STREQ((char *)attp->name, "bounds")) {
if(attp->type == NC_STRING && attp->valgp && NCSTREQ((char *)attp->name, "bounds")) {
return true;
}
#endif /* USE_NETCDF4 */
Expand Down
2 changes: 1 addition & 1 deletion ncdump/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ nc_inq_grpname_count(int ncid, int igrp, char **lgrps, idnode_t *grpids) {
char *grpname = lgrps[igrp];

/* permit empty string to also designate root group */
if(grpname[0] == '\0' || STREQ(grpname,"/")) {
if(grpname[0] == '\0' || NCSTREQ(grpname,"/")) {
count = 1;
idadd(grpids, ncid);
return count;
Expand Down
4 changes: 2 additions & 2 deletions ncdump/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include "config.h"

#ifndef STREQ
#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
#ifndef NCSTREQ
#define NCSTREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
#endif

/* Delimiter for separating netCDF groups in absolute pathnames, same as for HDF5 */
Expand Down
4 changes: 2 additions & 2 deletions ncdump/vardata.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ print_rows(
NC_CHECK(nc_get_vara(ncid, varid, cor, edg, (void *)valp));

/* Test if we should treat array of chars as strings along last dimension */
if(vp->type == NC_CHAR && (vp->fmt == 0 || STREQ(vp->fmt,"%s") || STREQ(vp->fmt,""))) {
if(vp->type == NC_CHAR && (vp->fmt == 0 || NCSTREQ(vp->fmt,"%s") || NCSTREQ(vp->fmt,""))) {
pr_tvals(vp, ncols, vals, cor);
} else { /* for non-text variables */
for(i=0; i < d0 - 1; i++) {
Expand Down Expand Up @@ -766,7 +766,7 @@ vardatax(
NC_CHECK(nc_get_vara(ncid, varid, cor, edg, vals) );
/* Test if we should treat array of chars as a string */
if(vp->type == NC_CHAR &&
(vp->fmt == 0 || STREQ(vp->fmt,"%s") || STREQ(vp->fmt,""))) {
(vp->fmt == 0 || NCSTREQ(vp->fmt,"%s") || NCSTREQ(vp->fmt,""))) {
pr_tvalsx(vp, ncols, 0, lastrow, (char *) vals);
} else {
pr_any_valsx(vp, ncols, 0, lastrow, vals);
Expand Down
2 changes: 1 addition & 1 deletion ncgen/ncgen.l
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ NIL|nil|Nil {
id = bbContents(lextext);
len = unescape(id,id,bbLength(lextext),ISIDENT);
bbSetlength(lextext,len);
if (STREQ(id, FILL_STRING)) return lexdebug(FILLMARKER);
if (NCSTREQ(id, FILL_STRING)) return lexdebug(FILLMARKER);
yylval.sym = install(id);
return lexdebug(IDENT);
}
Expand Down
4 changes: 2 additions & 2 deletions ncgen/ncgen.y
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
#define YY_NO_INPUT 1

/* True if string a equals string b*/
#ifndef STREQ
#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
#ifndef NCSTREQ
#define NCSTREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
#endif
#define VLENSIZE (sizeof(nc_vlen_t))
#define MAXFLOATDIM 4294967295.0
Expand Down
Loading

0 comments on commit c4bf958

Please # to comment.