| use strcmp (without length) for NUL terminated strings - geomyidae - A small C-… | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit 9ae1515e88c21de6e69311895af71e92e20f33c7 | |
| parent efc6bf445a594d555bfce6dd4487366f8dbb747e | |
| Author: Hiltjo Posthuma <[email protected]> | |
| Date: Mon, 10 Jul 2017 20:23:30 +0200 | |
| use strcmp (without length) for NUL terminated strings | |
| Signed-off-by: Christoph Lohmann <[email protected]> | |
| Diffstat: | |
| M ind.c | 6 +++--- | |
| 1 file changed, 3 insertions(+), 3 deletions(-) | |
| --- | |
| diff --git a/ind.c b/ind.c | |
| @@ -104,7 +104,7 @@ gettype(char *filename) | |
| end++; | |
| for(i = 0; type[i].end != nil; i++) | |
| - if(!strncasecmp(end, type[i].end, strlen(type[i].end))) | |
| + if(!strcasecmp(end, type[i].end)) | |
| return &type[i]; | |
| return &type[0]; | |
| @@ -249,11 +249,11 @@ void | |
| printelem(int fd, Elems *el, char *addr, char *port) | |
| { | |
| - if(!strncmp(el->e[3], "server", 6)) { | |
| + if(!strcmp(el->e[3], "server")) { | |
| free(el->e[3]); | |
| el->e[3] = xstrdup(addr); | |
| } | |
| - if(!strncmp(el->e[4], "port", 4)) { | |
| + if(!strcmp(el->e[4], "port")) { | |
| free(el->e[4]); | |
| el->e[4] = xstrdup(port); | |
| } |