aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-03 10:46:27 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-03 10:46:27 +0800
commit94b20e3128eaac566abfd7c0c773bb4c076c453e (patch)
tree5f399609fc0ca64f0fc28be1c6f8cb2ead84d71d
parentgit2d: Import BARE and UTF-8 utilities (diff)
downloadforge-94b20e3128eaac566abfd7c0c773bb4c076c453e.tar.gz
forge-94b20e3128eaac566abfd7c0c773bb4c076c453e.tar.zst
forge-94b20e3128eaac566abfd7c0c773bb4c076c453e.zip
git2d: Use extern inline for utf8_decode
-rw-r--r--Makefile4
-rw-r--r--git2d/utf8.c3
-rw-r--r--git2d/utf8.h2
3 files changed, 6 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index dd43574..6dd0781 100644
--- a/Makefile
+++ b/Makefile
@@ -21,8 +21,8 @@ utils/colb:
hookc/hookc:
-git2d/git2d: git2d/main.o git2d/bare.o
- $(CC) $(CFLAGS) `pkg-config --cflags --libs libgit2` -lpthread -o git2d/git2d $<
+git2d/git2d: git2d/main.o git2d/bare.o git2d/utf8.c
+ $(CC) $(CFLAGS) `pkg-config --cflags --libs libgit2` -lpthread -o git2d/git2d $^
version.go:
printf 'package main\n\nconst VERSION = "%s"\n' `git describe --tags --always --dirty` > $@
diff --git a/git2d/utf8.c b/git2d/utf8.c
new file mode 100644
index 0000000..2937cb6
--- /dev/null
+++ b/git2d/utf8.c
@@ -0,0 +1,3 @@
+#include "utf8.h"
+
+extern inline void *utf8_decode(void *buf, uint32_t *c, int *e);
diff --git a/git2d/utf8.h b/git2d/utf8.h
index 894cbd5..56c6285 100644
--- a/git2d/utf8.h
+++ b/git2d/utf8.h
@@ -26,7 +26,7 @@
* occurs, this pointer will be a guess that depends on the particular
* error, but it will always advance at least one byte.
*/
-static void *
+inline void *
utf8_decode(void *buf, uint32_t *c, int *e)
{
static const char lengths[] = {