summaryrefslogtreecommitdiffstats
path: root/support/kconfig/util.c
diff options
context:
space:
mode:
authorPetr Vorel <petr.vorel@gmail.com>2018-09-19 13:36:15 +0200
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>2018-09-20 23:14:38 +0200
commit6eacea5ae05e11bfc7b6557850ef7e4a0ba60bd7 (patch)
treeb9547dbbf6379abc2cf36430dda078f5b2ddae36 /support/kconfig/util.c
parent78dd830f15b0c175cb8c9d2fef7f0641a8733b29 (diff)
downloadbuildroot-6eacea5ae05e11bfc7b6557850ef7e4a0ba60bd7.tar.gz
buildroot-6eacea5ae05e11bfc7b6557850ef7e4a0ba60bd7.zip
support/kconfig: bump to kconfig from Linux 4.17-rc2
Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'support/kconfig/util.c')
-rw-r--r--support/kconfig/util.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/support/kconfig/util.c b/support/kconfig/util.c
index 60eb566180..18a8e52391 100644
--- a/support/kconfig/util.c
+++ b/support/kconfig/util.c
@@ -14,11 +14,11 @@
struct file *file_lookup(const char *name)
{
struct file *file;
- const char *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)) {
- free((void *)file_name);
+ free(file_name);
return file;
}
}
@@ -100,16 +100,6 @@ struct gstr str_new(void)
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)
{
@@ -126,7 +116,7 @@ void str_append(struct gstr *gs, const char *s)
if (s) {
l = strlen(gs->s) + strlen(s) + 1;
if (l > gs->len) {
- gs->s = realloc(gs->s, l);
+ gs->s = xrealloc(gs->s, l);
gs->len = l;
}
strcat(gs->s, s);
@@ -168,4 +158,22 @@ void *xcalloc(size_t nmemb, size_t size)
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);
+}
OpenPOWER on IntegriCloud