From 71fa96d10d8867635eb47445b4fce20a64e28f93 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Thu, 27 Apr 2023 20:05:08 +0000 Subject: [PATCH] Format source code. --- src/HeaderParser.c | 6 +++++- tools/src/hdoc.c | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/HeaderParser.c b/src/HeaderParser.c index 1546e88..8e08a95 100644 --- a/src/HeaderParser.c +++ b/src/HeaderParser.c @@ -566,11 +566,13 @@ HeaderParse(Stream * stream, HeaderExpr * expr) } else if (c == '[') { - /* Looks like we have an array. Slurp all the dimensions */ + /* Looks like we have an array. Slurp all the + * dimensions */ int block = 1; int i = wordLen; expr->data.global.name[i] = '['; + i++; while (1) @@ -596,11 +598,13 @@ HeaderParse(Stream * stream, HeaderExpr * expr) if (c == ';') { expr->data.global.name[i] = '\0'; + break; } else { expr->data.global.name[i] = c; + i++; } } diff --git a/tools/src/hdoc.c b/tools/src/hdoc.c index 14fa170..5d04bc2 100644 --- a/tools/src/hdoc.c +++ b/tools/src/hdoc.c @@ -300,8 +300,8 @@ main(int argc, char **argv) if (!isDocumented) { StreamPrintf(StreamStderr(), - "Error: Global %s is undocumented.\n", - expr.data.global.name); + "Error: Global %s is undocumented.\n", + expr.data.global.name); exit = EXIT_FAILURE; goto finish; } @@ -309,6 +309,7 @@ main(int argc, char **argv) { global = Malloc(sizeof(DocGlobal)); global->global = expr.data.global; + strncpy(global->docs, comment, sizeof(global->docs)); ArrayAdd(globals, global); isDocumented = 0;