projects
/
neverball
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
share/gui: don't use less of widget width for truncation than available
[neverball]
/
share
/
common.c
diff --git
a/share/common.c
b/share/common.c
index
92484fc
..
3818202
100644
(file)
--- a/
share/common.c
+++ b/
share/common.c
@@
-20,7
+20,6
@@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <errno.h>
#include <time.h>
#include <ctype.h>
#include <stdarg.h>
#include <time.h>
#include <ctype.h>
#include <stdarg.h>
@@
-39,21
+38,11
@@
int read_line(char **dst, fs_file fin)
char *line, *new;
size_t len0, len1;
char *line, *new;
size_t len0, len1;
- int eof;
-
- /* Make sure we'll read at least _some_ data. */
-
- if (fs_eof(fin))
- return 0;
line = NULL;
line = NULL;
- while (1)
+ while (fs_gets(buff, sizeof (buff), fin))
{
{
- /* Fill the buffer. */
-
- eof = fs_gets(buff, sizeof (buff), fin) == NULL;
-
/* Append to data read so far. */
if (line)
/* Append to data read so far. */
if (line)
@@
-79,9
+68,6
@@
int read_line(char **dst, fs_file fin)
line = realloc(line, len1 + 1);
break;
}
line = realloc(line, len1 + 1);
break;
}
-
- if (eof)
- break;
}
return (*dst = line) ? 1 : 0;
}
return (*dst = line) ? 1 : 0;
@@
-269,7
+255,7
@@
char *base_name(const char *name, const char *suffix)
base = path_last_sep(name);
base = path_last_sep(name);
- strncpy(buf, base ? base + 1 : name, sizeof (buf));
+ strncpy(buf, base ? base + 1 : name, sizeof (buf) - 1);
/* Remove the suffix. */
/* Remove the suffix. */