Added examples
FossilOrigin-Name: affc62bafc288eb7ab174a463aba77cc0afe6b9b75ab59d92b945245c38392dd
This commit is contained in:
parent
14a9c95eb8
commit
e50b8b29b0
5
src/cw/doxyfilter
Executable file
5
src/cw/doxyfilter
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cat $1 | sed 's/@endcomment/*\//g' | sed 's/@startcomment/\/*/g'
|
||||||
|
|
||||||
|
|
27
src/cw/examples/mavl_add_example.c
Normal file
27
src/cw/examples/mavl_add_example.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "cw/mavl.h"
|
||||||
|
...
|
||||||
|
|
||||||
|
mavldata_t * result, data;
|
||||||
|
mavl_t tree;
|
||||||
|
|
||||||
|
/* create a mavl tree to store integers */
|
||||||
|
|
||||||
|
tree = mavl_create(mavl_cmp_dword, NULL);
|
||||||
|
|
||||||
|
... do some other stuff
|
||||||
|
|
||||||
|
/* add the value 17 to the tree */
|
||||||
|
data.dword = 17;
|
||||||
|
result = mavl_add(tree,&data);
|
||||||
|
|
||||||
|
if (result == NULL )
|
||||||
|
printf("Error: %s", strerror(errno));
|
||||||
|
if (result == &data)
|
||||||
|
printf("Element already exists\n");
|
||||||
|
else
|
||||||
|
printf("Element successful addded");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user