Skip to content

Move non-function declarations from .c files to *.internals.h headers#84

Merged
logic-finder merged 4 commits into
mainfrom
copilot/fix-rtdbparse-internals
Jun 15, 2026
Merged

Move non-function declarations from .c files to *.internals.h headers#84
logic-finder merged 4 commits into
mainfrom
copilot/fix-rtdbparse-internals

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Non-function declarations (static variables and includes) were scattered in .c files instead of being consolidated in their corresponding *.internals.h headers, inconsistent with the project convention.

Changes

  • hhss/c/rtdbparse.crtdbparse.internals.h: moved #include <setjmp.h> and static jmp_buf env;
  • lib/wrappers.cwrappers.internals.h: moved static const char *realloc_errmsg and static const char *vfprintf_errmsg; added STATIC VARIABLES section
  • lib/readline.creadline.internals.h: moved static const char *errmsg; added STATIC VARIABLES section

Before (rtdbparse.c):

#include "rtdbparse.h"
#include "rtdbparse.internals.h"

#include <setjmp.h>

static jmp_buf env;

extern array_t *rtdbparse(array_t *linestr) { ...

After (rtdbparse.c):

#include "rtdbparse.h"
#include "rtdbparse.internals.h"

extern array_t *rtdbparse(array_t *linestr) { ...

Each *.internals.h is included by exactly one translation unit, so moving statics into them is safe and consistent with the existing pattern in files like lex.internals.h.

Copilot AI changed the title [WIP] Move non-function declarations to internal headers Move non-function declarations from .c files to *.internals.h headers Jun 15, 2026
Copilot AI requested a review from lshqqytiger June 15, 2026 02:54
@lshqqytiger lshqqytiger marked this pull request as ready for review June 15, 2026 02:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes the placement of module-local declarations by moving non-function declarations (includes and static variables) out of .c files and into their corresponding *.internals.h headers, aligning these modules with the existing “single translation unit + internals header” pattern used elsewhere in the codebase.

Changes:

  • Move realloc_errmsg / vfprintf_errmsg static error strings from lib/wrappers.c into lib/wrappers.internals.h.
  • Move errmsg static error string from lib/readline.c into lib/readline.internals.h.
  • Move <setjmp.h> and static jmp_buf env from hhss/c/rtdbparse.c into hhss/c/rtdbparse.internals.h.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/wrappers.internals.h Adds a STATIC VARIABLES section containing static error message strings used by wrappers.c.
lib/wrappers.c Removes file-local static error message definitions now centralized in wrappers.internals.h.
lib/readline.internals.h Adds a STATIC VARIABLES section containing the read error message used by readline.c.
lib/readline.c Removes the file-local static error message definition now provided by readline.internals.h.
hhss/c/rtdbparse.internals.h Moves setjmp dependency and env jump buffer into the internals header alongside other module statics.
hhss/c/rtdbparse.c Drops the now-redundant <setjmp.h> include and env definition from the translation unit.

Removed unnecessary empty lines in wrappers.c
@lshqqytiger lshqqytiger linked an issue Jun 15, 2026 that may be closed by this pull request

@logic-finder logic-finder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

신경써주셔서 감사합니다

Comment thread hhss/c/rtdbparse.internals.h Outdated
Comment thread hhss/c/rtdbparse.internals.h
@lshqqytiger

Copy link
Copy Markdown
Contributor

@copilot

Copilot AI requested a review from lshqqytiger June 15, 2026 08:55
@logic-finder logic-finder self-requested a review June 15, 2026 09:13

@logic-finder logic-finder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@logic-finder logic-finder merged commit dbc6637 into main Jun 15, 2026
1 check passed
@logic-finder logic-finder deleted the copilot/fix-rtdbparse-internals branch June 15, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtdbparse.c 수정

4 participants