commit bfa71e7

V. Luna  ·  2026-10-07 03:01:47 +0000 UTC
parent 18af04b
fix header files so clangd picks up the define
25 files changed,  +65, -0
M snac.c
+2, -0
1@@ -0,0 +1,2 @@
2+CompileFlags:
3+  Add: [-I., -I/usr/local/include, -I/home/v/opt/bearssl/include, -D_GNU_SOURCE, -DXS_IMPLEMENTATION]
M snac.c
+2, -0
 1@@ -1,7 +1,9 @@
 2 /* snac - A simple, minimalistic ActivityPub instance */
 3 /* copyright (c) 2022 - 2026 grunfink et al. / MIT license */
 4 
 5+#ifndef XS_IMPLEMENTATION
 6 #define XS_IMPLEMENTATION
 7+#endif
 8 
 9 #include "xs.h"
10 #include "xs_hex.h"
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_CURL_H
4 
5+#include "xs.h"
6+
7 xs_dict *xs_http_request(const char *method, const char *url,
8                         const xs_dict *headers,
9                         const xs_str *body, int b_size, int *status,
+5, -0
 1@@ -12,6 +12,11 @@
 2 
 3 #define _XS_FCGI_H
 4 
 5+#include "xs.h"
 6+#include "xs_url.h"
 7+#include "xs_match.h"
 8+#include <arpa/inet.h>
 9+
10  xs_dict *xs_fcgi_request(FILE *f, xs_str **payload, int *p_size, int *id);
11  void xs_fcgi_response(FILE *f, int status, const xs_dict *headers, const xs_str *body, int b_size, int id);
12 
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_GLOB_H
4 
5+#include "xs.h"
6+
7 xs_list *xs_glob_n(const char *spec, int basename, int reverse, int mark, int max);
8 #define xs_glob(spec, basename, reverse) xs_glob_n(spec, basename, reverse, 0, XS_ALL)
9 #define xs_glob_m(spec, basename, reverse) xs_glob_n(spec, basename, reverse, 1, XS_ALL)
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_HEX_H
4 
5+#include "xs.h"
6+
7  int xs_is_hex_digit(char str);
8  void xs_hex_enc_1(char **dst, const char **src);
9  int xs_hex_dec_1(char **dst, const char **src);
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_HTML_H
4 
5+#include "xs.h"
6+
7 typedef struct xs_html xs_html;
8 
9 xs_str *xs_html_encode(const char *str);
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_HTTP_H
4 
5+#include "xs.h"
6+
7 typedef enum {
8 #define HTTP_STATUS(code, name, text) HTTP_STATUS_ ## name = code,
9 #include "xs_http_codes.h"
+5, -0
 1@@ -4,6 +4,11 @@
 2 
 3 #define _XS_HTTPD_H
 4 
 5+#include "xs.h"
 6+#include "xs_io.h"
 7+#include "xs_url.h"
 8+#include "xs_socket.h"
 9+
10 xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size);
11 void xs_httpd_response(FILE *f, int status, const char *status_text,
12                         const xs_dict *headers, const xs_val *body, int b_size);
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_IO_H
4 
5+#include "xs.h"
6+
7 xs_str *xs_readline(FILE *f);
8 xs_val *xs_read(FILE *f, int *size);
9 xs_val *xs_readall(FILE *f);
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_JSON_H
4 
5+#include "xs.h"
6+
7 #ifndef MAX_JSON_DEPTH
8 #define MAX_JSON_DEPTH 32
9 #endif
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_LIST_TOOLS_H
4 
5+#include "xs.h"
6+
7  xs_list *xs_list_insert_sorted(xs_list *list, const xs_val *nv);
8  xs_val **xs_list_to_array(const xs_list *l, int *len);
9  int xs_list_sort_cmp(const void *p1, const void *p2);
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_MATCH_H
4 
5+#include "xs.h"
6+
7 /* spec is very similar to shell file globbing:
8    an * matches anything;
9    a ? matches any character;
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_MIME_H
4 
5+#include "xs.h"
6+
7 const char *xs_mime_by_ext(const char *file);
8 
9 extern const char *xs_mime_types[];
+3, -0
 1@@ -4,6 +4,9 @@
 2 
 3 #define _XS_OPENSSL_H
 4 
 5+#include "xs.h"
 6+#include "xs_hex.h"
 7+
 8 xs_str *_xs_digest(const xs_val *input, int size, const char *digest, int as_hex);
 9 
10 #ifndef _XS_MD5_H
+3, -0
 1@@ -4,6 +4,9 @@
 2 
 3 #define _XS_PO_H
 4 
 5+#include "xs.h"
 6+#include "xs_io.h"
 7+
 8 xs_dict *xs_po_to_dict(const char *fn);
 9 
10 #ifdef XS_IMPLEMENTATION
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_RANDOM_H
4 
5+#include "xs.h"
6+
7 unsigned int xs_rnd_int32_d(unsigned int *seed);
8 void *xs_rnd_buf(void *buf, int size);
9 
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_REGEX_H
4 
5+#include "xs.h"
6+
7 int xs_regex_match(const char *str, const char *rx);
8 xs_list *xs_regex_split_n(const char *str, const char *rx, int count);
9 #define xs_regex_split(str, rx) xs_regex_split_n(str, rx, XS_ALL)
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_SET_H
4 
5+#include "xs.h"
6+
7 typedef struct _xs_set {
8     int elems;              /* number of hash entries */
9     int used;               /* number of used hash entries */
+5, -0
 1@@ -4,6 +4,11 @@
 2 
 3 #define _XS_SOCKET_H
 4 
 5+#include "xs.h"
 6+#include <errno.h>
 7+#include <sys/time.h>
 8+#include <sys/types.h>
 9+
10 int xs_socket_timeout(int s, double rto, double sto);
11 int xs_socket_server(const char *addr, const char *serv);
12 int xs_socket_accept(int rs);
+1, -0
1@@ -4,6 +4,7 @@
2 
3 #define _XS_TIME_H
4 
5+#include "xs.h"
6 #include <time.h>
7 
8 xs_str *xs_str_time(time_t t, const char *fmt, int local);
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_UNICODE_H
4 
5+#include "xs.h"
6+
7  int xs_utf8_enc(char buf[4], unsigned int cpoint);
8  int xs_is_utf8_cont_byte(char c);
9  unsigned int xs_utf8_dec(const char **str);
+5, -0
 1@@ -4,6 +4,11 @@
 2 
 3 #define _XS_UNIX_SOCKET_H
 4 
 5+#include "xs.h"
 6+#include <unistd.h>
 7+#include <sys/socket.h>
 8+#include <sys/types.h>
 9+
10  int xs_unix_socket_server(const char *path, const char *grp);
11  int xs_unix_socket_connect(const char *path);
12 
+2, -0
1@@ -4,6 +4,8 @@
2 
3 #define _XS_URL_H
4 
5+#include "xs.h"
6+
7 xs_str *xs_url_dec(const char *str);
8 xs_str *xs_url_enc(const char *str);
9 xs_str *xs_url_dec_emoji(const char *str);
+4, -0
 1@@ -4,6 +4,10 @@
 2 
 3 #define _XS_WEBMENTION_H
 4 
 5+#include "xs.h"
 6+#include "xs_regex.h"
 7+#include "xs_curl.h"
 8+
 9 int xs_webmention_send(const char *source, const char *target, const char *user_agent);
10 int xs_webmention_hook(const char *source, const char *target, const char *user_agent);
11