diff options
author | Tom Hinton <tom.hinton@cse.org.uk> | 2015-10-01 11:41:44 +0100 |
---|---|---|
committer | Tom Hinton <tom.hinton@cse.org.uk> | 2015-10-01 11:41:44 +0100 |
commit | 574bf2da828b4e3ab0ce3ce7fccd58879db60430 (patch) | |
tree | 0f8d601a5780a0076c460f04c5ad268abc8a16d8 /source/helper.c | |
parent | 0e60aaf23500c45cab17b8f5e11ec234b137645d (diff) |
Make dmenu reading very marginally faster
A slight reduction in use of realloc and avoidance of 3 or 4 strlens for
a string we know the length of
Diffstat (limited to 'source/helper.c')
-rw-r--r-- | source/helper.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/helper.c b/source/helper.c index 94b90a28..fd3ee577 100644 --- a/source/helper.c +++ b/source/helper.c @@ -52,7 +52,7 @@ void cmd_set_arguments ( int argc, char **argv ) /** * `fgets` implementation with custom separator. */ -char* fgets_s ( char* s, int n, FILE *iop, char sep ) +char* fgets_s ( char* s, unsigned int n, FILE *iop, char sep ) { // Map these to registers. register int c = EOF; @@ -72,7 +72,7 @@ char* fgets_s ( char* s, int n, FILE *iop, char sep ) *cs = '\0'; // if last read was end of file and current index is start, we are done: // Return NULL. - return ( c == EOF && cs == s ) ? NULL : s; + return ( c == EOF && cs == s ) ? NULL : cs; } /** |