match_entry.c
This commit is contained in:
parent
f5996731ca
commit
a2bec00a9e
5 changed files with 44 additions and 21 deletions
19
include/match_entry.h
Normal file
19
include/match_entry.h
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* match_entry.h
|
||||||
|
* Copyright (C) 2014 c9s <c9s@c9smba.local>
|
||||||
|
*
|
||||||
|
* Distributed under terms of the MIT license.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MATCH_ENTRY_H
|
||||||
|
#define MATCH_ENTRY_H
|
||||||
|
|
||||||
|
#include "r3.h"
|
||||||
|
|
||||||
|
match_entry * match_entry_createl(const char * path, int path_len);
|
||||||
|
|
||||||
|
#define match_entry_create(path) match_entry_createl(path,strlen(path))
|
||||||
|
|
||||||
|
void match_entry_free(match_entry * entry);
|
||||||
|
|
||||||
|
#endif /* !MATCH_ENTRY_H */
|
|
@ -182,11 +182,6 @@ void r3_edge_free(edge * edge);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
match_entry * match_entry_createl(const char * path, int path_len);
|
|
||||||
|
|
||||||
#define match_entry_create(path) match_entry_createl(path,strlen(path))
|
|
||||||
|
|
||||||
void match_entry_free(match_entry * entry);
|
|
||||||
|
|
||||||
|
|
||||||
route * r3_route_create(const char * path);
|
route * r3_route_create(const char * path);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
lib_LTLIBRARIES = libr3.la
|
lib_LTLIBRARIES = libr3.la
|
||||||
# lib_LIBRARIES = libr3.a
|
# lib_LIBRARIES = libr3.a
|
||||||
libr3_la_SOURCES = node.c edge.c str.c token.c zmalloc.c
|
libr3_la_SOURCES = node.c edge.c str.c token.c zmalloc.c match_entry.c
|
||||||
# libr3_la_LDFLAGS = -export-symbols-regex '^r3_|^match_'
|
# libr3_la_LDFLAGS = -export-symbols-regex '^r3_|^match_'
|
||||||
|
|
||||||
libr3_la_LIBADD=$(DEPS_LIBS)
|
libr3_la_LIBADD=$(DEPS_LIBS)
|
||||||
|
|
24
src/match_entry.c
Normal file
24
src/match_entry.c
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* match_entry.c
|
||||||
|
* Copyright (C) 2014 c9s <c9s@c9smba.local>
|
||||||
|
*
|
||||||
|
* Distributed under terms of the MIT license.
|
||||||
|
*/
|
||||||
|
#include "match_entry.h"
|
||||||
|
#include "zmalloc.h"
|
||||||
|
|
||||||
|
match_entry * match_entry_createl(const char * path, int path_len) {
|
||||||
|
match_entry * entry = zmalloc(sizeof(match_entry));
|
||||||
|
if(!entry)
|
||||||
|
return NULL;
|
||||||
|
entry->vars = str_array_create(3);
|
||||||
|
entry->path = path;
|
||||||
|
entry->path_len = path_len;
|
||||||
|
entry->data = NULL;
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
void match_entry_free(match_entry * entry) {
|
||||||
|
str_array_free(entry->vars);
|
||||||
|
zfree(entry);
|
||||||
|
}
|
15
src/node.c
15
src/node.c
|
@ -223,21 +223,6 @@ void r3_tree_compile_patterns(node * n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
match_entry * match_entry_createl(const char * path, int path_len) {
|
|
||||||
match_entry * entry = zmalloc(sizeof(match_entry));
|
|
||||||
if(!entry)
|
|
||||||
return NULL;
|
|
||||||
entry->vars = str_array_create(3);
|
|
||||||
entry->path = path;
|
|
||||||
entry->path_len = path_len;
|
|
||||||
entry->data = NULL;
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
void match_entry_free(match_entry * entry) {
|
|
||||||
str_array_free(entry->vars);
|
|
||||||
zfree(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue