Skip to content

Commit 4753dc8

Browse files
Duncaenclassabbyamp
authored andcommitted
lib/format.c: IWYU
1 parent a140a7c commit 4753dc8

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

lib/format.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@
2828
#include <stdlib.h>
2929
#include <string.h>
3030

31+
#include "compat.h"
3132
#include "xbps/json.h"
33+
#include "xbps/xbps_array.h"
34+
#include "xbps/xbps_bool.h"
35+
#include "xbps/xbps_data.h"
36+
#include "xbps/xbps_dictionary.h"
37+
#include "xbps/xbps_number.h"
38+
#include "xbps/xbps_object.h"
39+
#include "xbps/xbps_string.h"
3240
#include "xbps_api_impl.h"
33-
#include "compat.h"
3441

3542
/**
3643
* @file lib/format.c
@@ -638,10 +645,6 @@ xbps_fmt(const struct xbps_fmt *fmt, xbps_fmt_cb *cb, void *data, FILE *fp)
638645
return 0;
639646
}
640647

641-
struct fmt_dict_cb {
642-
xbps_dictionary_t dict;
643-
};
644-
645648
int
646649
xbps_fmt_print_string(const struct xbps_fmt *fmt, const char *str, size_t len, FILE *fp)
647650
{
@@ -775,24 +778,28 @@ xbps_fmt_print_object(const struct xbps_fmt *fmt, xbps_object_t obj, FILE *fp)
775778
return 0;
776779
}
777780

781+
struct fmt_dict_ctx {
782+
xbps_dictionary_t dict;
783+
};
784+
778785
static int
779786
fmt_dict_cb(FILE *fp, const struct xbps_fmt *fmt, void *data)
780787
{
781-
struct fmt_dict_cb *ctx = data;
788+
struct fmt_dict_ctx *ctx = data;
782789
xbps_object_t obj = xbps_dictionary_get(ctx->dict, fmt->var);
783790
return xbps_fmt_print_object(fmt, obj, fp);
784791
}
785792

786793
int
787794
xbps_fmt_dictionary(const struct xbps_fmt *fmt, xbps_dictionary_t dict, FILE *fp)
788795
{
789-
struct fmt_dict_cb ctx = {.dict = dict};
796+
struct fmt_dict_ctx ctx = {.dict = dict};
790797
return xbps_fmt(fmt, &fmt_dict_cb, &ctx, fp);
791798
}
792799

793800
int
794801
xbps_fmts_dictionary(const char *format, xbps_dictionary_t dict, FILE *fp)
795802
{
796-
struct fmt_dict_cb ctx = {.dict = dict};
803+
struct fmt_dict_ctx ctx = {.dict = dict};
797804
return xbps_fmts(format, &fmt_dict_cb, &ctx, fp);
798805
}

0 commit comments

Comments
 (0)