Skip to content

Commit

Permalink
Fix expressions which evaluates to zero treated as a null pointer con…
Browse files Browse the repository at this point in the history
…stant (#1263)

Fixes -Wnon-literal-null-conversion compiler warnings.

Co-authored-by: Markus Metz <markus.metz.giswork@gmail.com>
  • Loading branch information
nilason and metzm committed Feb 4, 2021
1 parent 8da3d18 commit 3c108bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion db/db.select/main.c
Expand Up @@ -276,7 +276,7 @@ void parse_command_line(int argc, char **argv)
parms.table = table->answer;
parms.sql = sql->answer;
parms.fs = G_option_to_separator(fs);
parms.vs = '\0';
parms.vs = NULL;
if (vs->answer)
parms.vs = G_option_to_separator(vs);
parms.nv = nv->answer;
Expand Down
10 changes: 5 additions & 5 deletions lib/db/dbmi_base/login.c
Expand Up @@ -297,11 +297,11 @@ static int get_login(const char *driver, const char *database, const char **user

G_debug(3, "db_get_login(): drv=[%s] db=[%s]", driver, database);

user[0] = '\0';
password[0] = '\0';
host[0] = '\0';
port[0] = '\0';
*user = NULL;
*password = NULL;
*host = NULL;
*port = NULL;

init_login(&login);

if (read_file(&login) == -1)
Expand Down
4 changes: 2 additions & 2 deletions vector/v.category/main.c
Expand Up @@ -537,7 +537,7 @@ int main(int argc, char *argv[])
freps[fld]->table = G_store(Fi->table);
}
else {
freps[fld]->table = '\0';
freps[fld]->table = NULL;
}
}

Expand Down Expand Up @@ -601,7 +601,7 @@ int main(int argc, char *argv[])
freps[fld]->table = G_store(Fi->table);
}
else {
freps[fld]->table = '\0';
freps[fld]->table = NULL;
}
}

Expand Down

0 comments on commit 3c108bf

Please sign in to comment.