Skip to content

Commit

Permalink
Include used header files
Browse files Browse the repository at this point in the history
Make source files more self-contained by including the header files they use
(and remove some they don't).
This work was aided by the include_what_you_use tool.
  • Loading branch information
Erik Olsson committed Jan 1, 2025
1 parent 61fc3d0 commit 43686ff
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#include <unistd.h>
#endif

#include "hashtable.h"
#include "jansson.h"
#include "jansson_config.h"
#include "strbuffer.h"
#include "utf.h"

Expand Down
3 changes: 3 additions & 0 deletions src/error.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "jansson.h"
#include "jansson_private.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

void jsonp_error_init(json_error_t *error, const char *source) {
Expand Down
2 changes: 0 additions & 2 deletions src/hashtable_seed.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#include <windows.h>
#endif

#include "jansson.h"

static uint32_t buf_to_uint32(char *data) {
size_t i;
uint32_t result = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#define _GNU_SOURCE
#endif

#include "jansson_config.h"
#include "jansson_private.h"

#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
Expand Down
4 changes: 4 additions & 0 deletions src/pack_unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
*/

#include "jansson.h"
#include "jansson_config.h"
#include "jansson_private.h"
#include "hashtable.h"
#include "strbuffer.h"
#include "utf.h"
#include <stdarg.h>
#include <string.h>

typedef struct {
Expand Down
1 change: 1 addition & 0 deletions src/strbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "strbuffer.h"
#include "jansson_private.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>

Expand Down
2 changes: 2 additions & 0 deletions src/strconv.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "jansson_config.h"
#include "jansson_private.h"
#include "strbuffer.h"
#include <assert.h>
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* need jansson_private_config.h to get the correct snprintf */
Expand Down
1 change: 0 additions & 1 deletion src/utf.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

#include "utf.h"
#include <string.h>

int utf8_encode(int32_t codepoint, char *buffer, size_t *size) {
if (codepoint < 0)
Expand Down
3 changes: 3 additions & 0 deletions src/value.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#endif

#include <math.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Expand All @@ -24,6 +26,7 @@

#include "hashtable.h"
#include "jansson.h"
#include "jansson_config.h"
#include "jansson_private.h"
#include "utf.h"

Expand Down

0 comments on commit 43686ff

Please sign in to comment.