projects
/
carl9170fw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kconfig: do not call check_conf() for olddefconfig
[carl9170fw.git]
/
config
/
util.c
diff --git
a/config/util.c
b/config/util.c
index 6e7fbf1968090463f37ec1af70d65fb0af28a391..c6f6e21b809ffe7a6f60acd2a7f016ee88971d5c 100644
(file)
--- a/
config/util.c
+++ b/
config/util.c
@@
-14,11
+14,11
@@
struct file *file_lookup(const char *name)
{
struct file *file;
struct file *file_lookup(const char *name)
{
struct file *file;
- c
onst c
har *file_name = sym_expand_string_value(name);
+ char *file_name = sym_expand_string_value(name);
for (file = file_list; file; file = file->next) {
if (!strcmp(name, file->name)) {
for (file = file_list; file; file = file->next) {
if (!strcmp(name, file->name)) {
- free(
(void *)
file_name);
+ free(file_name);
return file;
}
}
return file;
}
}
@@
-88,16
+88,6
@@
struct gstr str_new(void)
return gs;
}
return gs;
}
-/* Allocate and assign growable string */
-struct gstr str_assign(const char *s)
-{
- struct gstr gs;
- gs.s = strdup(s);
- gs.len = strlen(s) + 1;
- gs.max_width = 0;
- return gs;
-}
-
/* Free storage for growable string */
void str_free(struct gstr *gs)
{
/* Free storage for growable string */
void str_free(struct gstr *gs)
{
@@
-114,7
+104,7
@@
void str_append(struct gstr *gs, const char *s)
if (s) {
l = strlen(gs->s) + strlen(s) + 1;
if (l > gs->len) {
if (s) {
l = strlen(gs->s) + strlen(s) + 1;
if (l > gs->len) {
- gs->s
=
realloc(gs->s, l);
+ gs->s
= x
realloc(gs->s, l);
gs->len = l;
}
strcat(gs->s, s);
gs->len = l;
}
strcat(gs->s, s);
@@
-156,4
+146,22
@@
void *xcalloc(size_t nmemb, size_t size)
exit(1);
}
exit(1);
}
+void *xrealloc(void *p, size_t size)
+{
+ p = realloc(p, size);
+ if (p)
+ return p;
+ fprintf(stderr, "Out of memory.\n");
+ exit(1);
+}
+char *xstrdup(const char *s)
+{
+ char *p;
+
+ p = strdup(s);
+ if (p)
+ return p;
+ fprintf(stderr, "Out of memory.\n");
+ exit(1);
+}