aboutsummaryrefslogtreecommitdiffstats
path: root/libautomata_clone_kmp_automaton.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-12-17 16:20:43 +0100
committerMattias Andrée <m@maandree.se>2025-12-17 16:20:43 +0100
commitae89f342b51cb4ef71f18e89b74585cd61b05a60 (patch)
treedac1ec69cb74001aacce013bb5879566bb04d845 /libautomata_clone_kmp_automaton.c
downloadlibautomata-ae89f342b51cb4ef71f18e89b74585cd61b05a60.tar.gz
libautomata-ae89f342b51cb4ef71f18e89b74585cd61b05a60.tar.bz2
libautomata-ae89f342b51cb4ef71f18e89b74585cd61b05a60.tar.xz
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libautomata_clone_kmp_automaton.c')
-rw-r--r--libautomata_clone_kmp_automaton.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libautomata_clone_kmp_automaton.c b/libautomata_clone_kmp_automaton.c
new file mode 100644
index 0000000..b862f23
--- /dev/null
+++ b/libautomata_clone_kmp_automaton.c
@@ -0,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+LIBAUTOMATA_KMP_AUTOMATON *
+libautomata_clone_kmp_automaton(const LIBAUTOMATA_KMP_AUTOMATON *automaton)
+{
+ size_t size = sizeof_kmp_automaton(automaton->length, automaton->elemsize);
+ LIBAUTOMATA_KMP_AUTOMATON *ret = malloc(size);
+ if (ret)
+ memcpy(ret, automaton, size);
+ return ret;
+}