Skip to content

Commit dbc6637

Browse files
Copilotlshqqytiger
andauthored
fix: move non-function declarations from .c files to *.internals.h headers (#84)
* Initial plan * Move non-function declarations to *.internals.h headers * Clean up whitespace in wrappers.c Removed unnecessary empty lines in wrappers.c * Apply review suggestions to rtdbparse.internals.h --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Seunghoon Lee <lshqqytiger@naver.com>
1 parent 279da49 commit dbc6637

6 files changed

Lines changed: 14 additions & 10 deletions

File tree

hhss/c/rtdbparse.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#include "rtdbparse.h"
22
#include "rtdbparse.internals.h"
33

4-
#include <setjmp.h>
5-
6-
static jmp_buf env;
7-
84
extern array_t *rtdbparse(array_t *linestr) {
95
array_t *table, *sectarr;
106
char *sectname;

hhss/c/rtdbparse.internals.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* INCLUDES *
66
************/
77
#include <ctype.h>
8+
#include <setjmp.h>
89
#include <stdlib.h>
910
#include <string.h>
1011
#
@@ -41,6 +42,8 @@ static void synerr(void);
4142
********************/
4243
static const char *whitespaces = " \a\b\t\n\v\f\r";
4344

45+
static jmp_buf env;
46+
4447
static array_t *ls;
4548
static line_t *l;
4649
static size_t idx, len;

lib/readline.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include "readline.h"
22
#include "readline.internals.h"
33

4-
static const char *errmsg = "unable to read";
5-
64
extern int readln(FILE *fp, char **line, size_t *len) {
75
int ch;
86
size_t pos, bufsiz;

lib/readline.internals.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@
1212
**********/
1313
#define READLINE_UNIT 64
1414

15+
/********************
16+
* STATIC VARIABLES *
17+
********************/
18+
static const char *errmsg = "unable to read";
19+
1520
#endif

lib/wrappers.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ extern void safe_fputs(FILE *stream, const char *line) {
2323
/************
2424
* stdlib.h *
2525
************/
26-
static const char *realloc_errmsg = "realloc error";
27-
2826
extern void *safe_malloc(size_t siz) {
2927
void *ret = malloc(siz);
3028
if (!ret) ERR("malloc error");
@@ -66,8 +64,6 @@ extern void *safe_realloc2x_arr(void *orig_arr, size_t *cnt, size_t esiz) {
6664
/************
6765
* stdarg.h *
6866
************/
69-
static const char *vfprintf_errmsg = "vfprintf error";
70-
7167
extern void safe_fprintf(FILE *stream, const char *format, ...) {
7268
va_list ap;
7369
int ret;

lib/wrappers.internals.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@
99
#
1010
#include "fatal.h"
1111

12+
/********************
13+
* STATIC VARIABLES *
14+
********************/
15+
static const char *realloc_errmsg = "realloc error";
16+
static const char *vfprintf_errmsg = "vfprintf error";
17+
1218
#endif

0 commit comments

Comments
 (0)