History

various: reduce the include scope of some public headers

Kacper Michajłow committed 1 year ago

Commit 77313f71 parent b848ffa16 files · +30 −24Browse files

Showing the changes to misc (4 of 16 files). Show all

Unified · Split

4 files
  1. misc/json.c +2 −0
  2. misc/json.h +1 −3
  3. misc/node.c +6 −3
  4. misc/node.h +9 −6
misc/json.c+2−0
@@ -48,6 +48,8 @@ · 47 unmodified lines
48#include <inttypes.h>48#include <inttypes.h>
49#include <assert.h>49#include <assert.h>
50 50
51#include <libmpv/client.h>
52
51#include "common/common.h"53#include "common/common.h"
52#include "misc/bstr.h"54#include "misc/bstr.h"
53#include "misc/ctype.h"55#include "misc/ctype.h"
misc/json.h+1−3
@@ -18,12 +18,10 @@ · 17 unmodified lines
18#ifndef MP_JSON_H18#ifndef MP_JSON_H
19#define MP_JSON_H19#define MP_JSON_H
20 20
21// We reuse mpv_node.
22#include "libmpv/client.h"
23
24#define MAX_JSON_DEPTH 5021#define MAX_JSON_DEPTH 50
25 22
26struct bstr;23struct bstr;
24struct mpv_node;
27 25
28int json_parse(void *ta_parent, struct mpv_node *dst, char **src, int max_depth);26int json_parse(void *ta_parent, struct mpv_node *dst, char **src, int max_depth);
29int json_append(struct bstr *b, const struct mpv_node *src, int indent);27int json_append(struct bstr *b, const struct mpv_node *src, int indent);
misc/node.c+6−3
@@ -1,7 +1,10 @@
1#include "common/common.h"
2
3#include "node.h"1#include "node.h"
4 2
3#include <libmpv/client.h>
4
5#include "common/common.h"
6#include "bstr.h"
7
5// Init a node with the given format. If parent is not NULL, it is set as8// Init a node with the given format. If parent is not NULL, it is set as
6// parent allocation according to m_option_type_node rules (which means9// parent allocation according to m_option_type_node rules (which means
7// the mpv_node_list allocs are used for chaining the TA allocations).10// the mpv_node_list allocs are used for chaining the TA allocations).
@@ -117,7 +120,7 @@ mpv_node *node_map_bget(mpv_node *src, struct bstr key) · 109 unmodified lines
117 120
118// Note: for MPV_FORMAT_NODE_MAP, this (incorrectly) takes the order into121// Note: for MPV_FORMAT_NODE_MAP, this (incorrectly) takes the order into
119// account, instead of treating it as set.122// account, instead of treating it as set.
120bool equal_mpv_value(const void *a, const void *b, mpv_format format)123bool equal_mpv_value(const void *a, const void *b, int format)
121{124{
122 switch (format) {125 switch (format) {
123 case MPV_FORMAT_NONE:126 case MPV_FORMAT_NONE:
misc/node.h+9−6
@@ -1,21 +1,24 @@
1#ifndef MP_MISC_NODE_H_1#ifndef MP_MISC_NODE_H_
2#define MP_MISC_NODE_H_2#define MP_MISC_NODE_H_
3 3
4#include "libmpv/client.h"4#include <stdbool.h>
5#include "misc/bstr.h"5#include <stdint.h>
6
7struct bstr;
8struct mpv_node;
6 9
7void node_init(struct mpv_node *dst, int format, struct mpv_node *parent);10void node_init(struct mpv_node *dst, int format, struct mpv_node *parent);
8struct mpv_node *node_array_add(struct mpv_node *dst, int format);11struct mpv_node *node_array_add(struct mpv_node *dst, int format);
9struct mpv_node *node_map_add(struct mpv_node *dst, const char *key, int format);12struct mpv_node *node_map_add(struct mpv_node *dst, const char *key, int format);
10struct mpv_node *node_map_badd(struct mpv_node *dst, struct bstr key, int format);13struct mpv_node *node_map_badd(struct mpv_node *dst, struct bstr key, int format);
11void node_map_add_string(struct mpv_node *dst, const char *key, const char *val);14void node_map_add_string(struct mpv_node *dst, const char *key, const char *val);
12void node_map_add_bstr(struct mpv_node *dst, const char *key, bstr val);15void node_map_add_bstr(struct mpv_node *dst, const char *key, struct bstr val);
13void node_map_add_int64(struct mpv_node *dst, const char *key, int64_t v);16void node_map_add_int64(struct mpv_node *dst, const char *key, int64_t v);
14void node_map_add_double(struct mpv_node *dst, const char *key, double v);17void node_map_add_double(struct mpv_node *dst, const char *key, double v);
15void node_map_add_flag(struct mpv_node *dst, const char *key, bool v);18void node_map_add_flag(struct mpv_node *dst, const char *key, bool v);
16mpv_node *node_map_get(mpv_node *src, const char *key);19struct mpv_node *node_map_get(struct mpv_node *src, const char *key);
17mpv_node *node_map_bget(mpv_node *src, struct bstr key);20struct mpv_node *node_map_bget(struct mpv_node *src, struct bstr key);
18bool equal_mpv_value(const void *a, const void *b, mpv_format format);21bool equal_mpv_value(const void *a, const void *b, int format);
19bool equal_mpv_node(const struct mpv_node *a, const struct mpv_node *b);22bool equal_mpv_node(const struct mpv_node *a, const struct mpv_node *b);
20 23
21#endif24#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t