From: Michael Tremer Date: Tue, 27 Sep 2022 16:28:44 +0000 (+0000) Subject: writer: Add an empty string to the stringpool X-Git-Tag: 0.9.16~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5a722ccd498ac24b560f9cbe4e73e6a25aaa33e;p=location%2Flibloc.git writer: Add an empty string to the stringpool This is useful when we have some offset that isn't initialised. It will point to the start of the string pool which is some random string that happened to be added first. An empty string at least signifies better that something is unset. Signed-off-by: Michael Tremer --- diff --git a/src/writer.c b/src/writer.c index 51e9a8e..b52f74f 100644 --- a/src/writer.c +++ b/src/writer.c @@ -102,6 +102,13 @@ LOC_EXPORT int loc_writer_new(struct loc_ctx* ctx, struct loc_writer** writer, return r; } + // Add an empty string to the stringpool + r = loc_stringpool_add(w->pool, ""); + if (r) { + loc_writer_unref(w); + return r; + } + // Initialize the network tree r = loc_network_tree_new(ctx, &w->networks); if (r) {