Fix simple.c and examples/Makefile.am

This commit is contained in:
c9s 2014-06-03 22:41:39 +08:00
parent db45ae3e53
commit 2ff85c876d
6 changed files with 8 additions and 15 deletions

View file

@ -1,4 +1,4 @@
SUBDIRS=3rdparty src . tests SUBDIRS=3rdparty src . tests examples
lib_LTLIBRARIES = libr3.la lib_LTLIBRARIES = libr3.la
libr3_la_SOURCES = libr3_la_SOURCES =

View file

@ -41,8 +41,6 @@ API
```c ```c
#include <r3.h> #include <r3.h>
#include <r3_str.h>
// create a router tree with 10 children capacity (this capacity can grow dynamically) // create a router tree with 10 children capacity (this capacity can grow dynamically)
n = r3_tree_create(10); n = r3_tree_create(10);

View file

@ -127,5 +127,6 @@ AC_CONFIG_FILES([
3rdparty/Makefile 3rdparty/Makefile
src/Makefile src/Makefile
tests/Makefile tests/Makefile
examples/Makefile
]) ])
AC_OUTPUT AC_OUTPUT

View file

@ -1,6 +0,0 @@
#
# Makefile
# c9s, 2014-06-03 21:58
#
all:
gcc `pkg-config --libs --cflags r3 libpcre` simple.c -o simple

5
examples/Makefile.am Normal file
View file

@ -0,0 +1,5 @@
AM_CFLAGS=$(DEPS_CFLAGS) $(GVC_DEPS_CFLAGS) -I$(top_builddir)/include -Wall -std=c99
AM_LDFLAGS=$(DEPS_LIBS) $(GVC_DEPS_LIBS) $(top_builddir)/libr3.la
noinst_PROGRAMS = simple
simple_SOURCES = simple.c

View file

@ -6,17 +6,12 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include "r3.h"
#include <stdarg.h> /* va_list, va_start, va_arg, va_end */
#include "r3/r3.h"
int main() int main()
{ {
node * n = r3_tree_create(3); node * n = r3_tree_create(3);
int route_data = 999;
r3_tree_insert_path(n, "/foo/bar/baz", NULL); r3_tree_insert_path(n, "/foo/bar/baz", NULL);
r3_tree_insert_path(n, "/foo/bar/qux", NULL); r3_tree_insert_path(n, "/foo/bar/qux", NULL);
r3_tree_insert_path(n, "/foo/bar/quux", NULL); r3_tree_insert_path(n, "/foo/bar/quux", NULL);