Skip to content

Commit

Permalink
Fix comparing a pointer to a null character constant (OSGeo#1265)
Browse files Browse the repository at this point in the history
Addresses -Wpointer-compare compiler warnings.
  • Loading branch information
nilason authored and marisn committed Mar 22, 2021
1 parent 4637fef commit 8913c94
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/db/dbmi_client/c_list_drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const char *db_list_drivers(void)
else {
/* build the comma separated string of existing drivers */
for (cur = list; cur; cur = cur->next) {
if (cur->driverName == '\0')
if (cur->driverName[0] == '\0')
break;
else {
if (cur != list)
Expand Down
2 changes: 1 addition & 1 deletion lib/db/dbmi_client/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ dbDriver *db_start_driver(const char *name)
return (dbDriver *) NULL;

/* if name is empty use connection.driverName, added by RB 4/2000 */
if (name == '\0') {
if (name[0] == '\0') {
db_get_connection(&connection);
if (NULL == (name = connection.driverName))
return (dbDriver *) NULL;
Expand Down
4 changes: 2 additions & 2 deletions lib/gis/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ void check_opts(void)
check_an_opt(opt->key, opt->type,
opt->options, opt->opts, &opt->answer);
else {
for (ans = 0; opt->answers[ans] != '\0'; ans++)
for (ans = 0; opt->answers[ans] != NULL; ans++)
check_an_opt(opt->key, opt->type,
opt->options, opt->opts, &opt->answers[ans]);
}
Expand Down Expand Up @@ -1529,7 +1529,7 @@ void check_multiple_opts(void)
if (*ptr == ',')
n_commas++;
/* count items */
for (n = 0; opt->answers[n] != '\0'; n++) ;
for (n = 0; opt->answers[n] != NULL; n++) ;
/* if not correct multiple of items */
if (n % n_commas) {
G_asprintf(&err,
Expand Down

0 comments on commit 8913c94

Please sign in to comment.