From def61cd5cef9c34b54535e1e746eecf70bbf7191 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 20 Jan 2025 18:39:18 +0000 Subject: [PATCH] great include fix --- test/array.c | 4 +- test/b64decode.c | 4 +- test/b64encode.c | 4 +- test/buffer_1.c | 2 +- test/buffer_fromsa.c | 4 +- test/buffer_mmap.c | 2 +- test/buffer_tosa.c | 6 +- test/byte_copy.c | 4 +- test/cdbget2.c | 6 +- test/cescape.c | 4 +- test/client.c | 10 ++-- test/dllink.c | 9 ++- test/dnsip.c | 8 +-- test/fdpassing.c | 4 +- test/fmt.c | 2 +- test/fmt_httpdate.c | 6 +- test/fmt_human.c | 4 +- test/fmt_ip6.c | 2 +- test/fmt_iso8691.c | 4 +- test/fmt_long.c | 4 +- test/fmt_longlong.c | 8 +-- test/fmt_strm_alloca.c | 6 +- test/fmt_xmlescape.c | 15 +++++ test/httpd.c | 20 +++---- test/io.c | 2 +- test/io2.c | 2 +- test/io3.c | 4 +- test/io4.c | 4 +- test/io5.c | 8 +-- test/iob.c | 2 +- test/iom.c | 2 +- test/iombench.c | 127 +++++++++++++++++++++++++++++++++++++++++ test/json.c | 2 +- test/marshal.c | 24 ++++---- test/mult.c | 2 +- test/netstring.c | 5 +- test/protobuf.c | 4 +- test/proxy.c | 14 ++--- test/range.c | 2 +- test/readhttp.c | 6 +- test/scan.c | 2 +- test/scan_long.c | 6 +- test/server.c | 10 ++-- test/stralloc_buffer.c | 4 +- test/stralloc_chomp.c | 4 +- test/textcode.c | 5 +- test/unurl.c | 4 +- test/urlencode.c | 4 +- test/utf8.c | 4 +- test/uudecode.c | 15 +++-- test/vd.c | 5 +- 51 files changed, 277 insertions(+), 138 deletions(-) create mode 100644 test/fmt_xmlescape.c create mode 100644 test/iombench.c diff --git a/test/array.c b/test/array.c index 3aa3de1..33554c7 100644 --- a/test/array.c +++ b/test/array.c @@ -1,6 +1,6 @@ #include -#include "array.h" -#include "byte.h" +#include +#include int main() { static array x,y; diff --git a/test/b64decode.c b/test/b64decode.c index a3bee12..cd8cd6d 100644 --- a/test/b64decode.c +++ b/test/b64decode.c @@ -1,7 +1,7 @@ #include #include -#include "buffer.h" -#include "textcode.h" +#include +#include #include "havealloca.h" void b64encode(const char* c) { diff --git a/test/b64encode.c b/test/b64encode.c index 95e9ed3..760425d 100644 --- a/test/b64encode.c +++ b/test/b64encode.c @@ -1,7 +1,7 @@ #include #include -#include "buffer.h" -#include "textcode.h" +#include +#include #include "havealloca.h" void b64encode(const char* c,long len) { diff --git a/test/buffer_1.c b/test/buffer_1.c index 8f1ea95..c8419a7 100644 --- a/test/buffer_1.c +++ b/test/buffer_1.c @@ -1,4 +1,4 @@ -#include "buffer.h" +#include int main() { buffer_puts(buffer_1,"ulong: "); diff --git a/test/buffer_fromsa.c b/test/buffer_fromsa.c index 52ce468..6757254 100644 --- a/test/buffer_fromsa.c +++ b/test/buffer_fromsa.c @@ -1,5 +1,5 @@ -#include "stralloc.h" -#include "buffer.h" +#include +#include int main() { stralloc sa; diff --git a/test/buffer_mmap.c b/test/buffer_mmap.c index 13507d3..cb6509d 100644 --- a/test/buffer_mmap.c +++ b/test/buffer_mmap.c @@ -1,4 +1,4 @@ -#include "buffer.h" +#include int main() { buffer input; diff --git a/test/buffer_tosa.c b/test/buffer_tosa.c index 2624053..837dbf5 100644 --- a/test/buffer_tosa.c +++ b/test/buffer_tosa.c @@ -1,6 +1,6 @@ -#include "byte.h" -#include "stralloc.h" -#include "buffer.h" +#include +#include +#include #include int main() { diff --git a/test/byte_copy.c b/test/byte_copy.c index 1e16f06..e638b09 100644 --- a/test/byte_copy.c +++ b/test/byte_copy.c @@ -1,6 +1,6 @@ -#include "byte.h" +#include +#include #include -#include "errmsg.h" #include char buf[4096]; diff --git a/test/cdbget2.c b/test/cdbget2.c index b4416cf..eedcfe0 100644 --- a/test/cdbget2.c +++ b/test/cdbget2.c @@ -1,9 +1,9 @@ -#include -#include "buffer.h" +#include +#include +#include #include #include #include -#include "errmsg.h" #ifndef O_BINARY #define O_BINARY 0 diff --git a/test/cescape.c b/test/cescape.c index 97928ee..09da588 100644 --- a/test/cescape.c +++ b/test/cescape.c @@ -1,6 +1,6 @@ #include -#include "buffer.h" -#include "textcode.h" +#include +#include #include "havealloca.h" #include diff --git a/test/client.c b/test/client.c index b2690a0..ca2049a 100644 --- a/test/client.c +++ b/test/client.c @@ -1,13 +1,13 @@ -#include "scan.h" -#include "ip6.h" -#include "str.h" +#include +#include +#include #include #include #include #include -#include "socket.h" +#include #include -#include "ndelay.h" +#include #ifdef __dietlibc__ #include #else diff --git a/test/dllink.c b/test/dllink.c index 4015b22..3759428 100644 --- a/test/dllink.c +++ b/test/dllink.c @@ -1,11 +1,10 @@ -#include +#include +#include +#include +#include -#include "socket.h" -#include "buffer.h" #include #include -#include "case.h" -#include "ndelay.h" int main(int argc,char* argv[]) { int s=socket_tcp4b(); diff --git a/test/dnsip.c b/test/dnsip.c index 8669b7b..3a3b214 100644 --- a/test/dnsip.c +++ b/test/dnsip.c @@ -1,9 +1,9 @@ -#include -#include -#include "buffer.h" +#include +#include +#include +#include #include #include -#include "errmsg.h" int main(int argc,char* argv[]) { static char seed[128]; diff --git a/test/fdpassing.c b/test/fdpassing.c index de0b6de..a3f24c9 100644 --- a/test/fdpassing.c +++ b/test/fdpassing.c @@ -1,6 +1,6 @@ #include -#include "io.h" -#include "buffer.h" +#include +#include #include void child(int64 fd) { diff --git a/test/fmt.c b/test/fmt.c index 9a7fdfd..33699d2 100644 --- a/test/fmt.c +++ b/test/fmt.c @@ -1,4 +1,4 @@ -#include "fmt.h" +#include #include #include diff --git a/test/fmt_httpdate.c b/test/fmt_httpdate.c index 2c5ae79..660ec97 100644 --- a/test/fmt_httpdate.c +++ b/test/fmt_httpdate.c @@ -1,7 +1,7 @@ #include -#include "scan.h" -#include "buffer.h" -#include "fmt.h" +#include +#include +#include int main() { char buf[100]; diff --git a/test/fmt_human.c b/test/fmt_human.c index b881e57..c2a2703 100644 --- a/test/fmt_human.c +++ b/test/fmt_human.c @@ -1,5 +1,5 @@ -#include "fmt.h" -#include "buffer.h" +#include +#include int main() { char buf[1024]; diff --git a/test/fmt_ip6.c b/test/fmt_ip6.c index 727cf8f..6e289d9 100644 --- a/test/fmt_ip6.c +++ b/test/fmt_ip6.c @@ -1,4 +1,4 @@ -#include "ip6.h" +#include #include #include diff --git a/test/fmt_iso8691.c b/test/fmt_iso8691.c index 5104bdc..1ac1023 100644 --- a/test/fmt_iso8691.c +++ b/test/fmt_iso8691.c @@ -1,5 +1,5 @@ -#include "fmt.h" -#include "scan.h" +#include +#include #include #include diff --git a/test/fmt_long.c b/test/fmt_long.c index cb7d8c8..a30c984 100644 --- a/test/fmt_long.c +++ b/test/fmt_long.c @@ -1,5 +1,5 @@ -#include "fmt.h" -#include "str.h" +#include +#include #include int main() { diff --git a/test/fmt_longlong.c b/test/fmt_longlong.c index 60eb9bb..35c4c05 100644 --- a/test/fmt_longlong.c +++ b/test/fmt_longlong.c @@ -1,8 +1,8 @@ -#include "fmt.h" -#include "str.h" +#include +#include +#include +#include #include -#include "scan.h" -#include int main() { char buf[1024]; diff --git a/test/fmt_strm_alloca.c b/test/fmt_strm_alloca.c index 328493c..2fc5694 100644 --- a/test/fmt_strm_alloca.c +++ b/test/fmt_strm_alloca.c @@ -1,6 +1,6 @@ -#include -#include "fmt.h" -#include "byte.h" +#include "havealloca.h" +#include +#include #include int main() { diff --git a/test/fmt_xmlescape.c b/test/fmt_xmlescape.c new file mode 100644 index 0000000..6ad962d --- /dev/null +++ b/test/fmt_xmlescape.c @@ -0,0 +1,15 @@ +#include +#include +#include + +int main() { + char buf[100]; + assert(fmt_xmlescape(buf,0)==0); + assert(fmt_xmlescape(buf,23)==1); + assert(fmt_xmlescape(buf,2342)==fmt_utf8(NULL,2342)); + assert(fmt_xmlescape(buf,'&')==5 && byte_equal(buf,5,"&")); + assert(fmt_xmlescape(buf,'<')==4 && byte_equal(buf,4,"<")); + assert(fmt_xmlescape(buf,'\t')==1 && buf[0]==9); + assert(fmt_xmlescape(buf,8)==5 && byte_equal(buf,5,"")); + return 0; +} diff --git a/test/httpd.c b/test/httpd.c index 6c0a142..043f7d2 100644 --- a/test/httpd.c +++ b/test/httpd.c @@ -1,12 +1,12 @@ -#include "socket.h" -#include "io.h" -#include "buffer.h" -#include "ip6.h" -#include "array.h" -#include "case.h" -#include "fmt.h" -#include "iob.h" -#include "str.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -276,7 +276,7 @@ emerge: } else if (array_bytes(&h->r)>8192) { httperror(h,"500 request too long","You sent too much headers"); goto emerge; - } else if ((l=header_complete(h))) + } else if (header_complete(h)) httpresponse(h,i); } } diff --git a/test/io.c b/test/io.c index 9cdf31a..caea198 100644 --- a/test/io.c +++ b/test/io.c @@ -1,4 +1,4 @@ -#include "io.h" +#include char buf[65536]; int64 readpos = 0; diff --git a/test/io2.c b/test/io2.c index 36dc1cf..9edca05 100644 --- a/test/io2.c +++ b/test/io2.c @@ -1,4 +1,4 @@ -#include "io.h" +#include char buf[65536]; int64 readpos = 0; diff --git a/test/io3.c b/test/io3.c index d3eab0c..22ceca8 100644 --- a/test/io3.c +++ b/test/io3.c @@ -1,6 +1,6 @@ #include -#include "buffer.h" -#include "io.h" +#include +#include int main() { int64 pfd[2]; diff --git a/test/io4.c b/test/io4.c index f672555..17cf37e 100644 --- a/test/io4.c +++ b/test/io4.c @@ -1,5 +1,5 @@ -#include "io.h" -#include "buffer.h" +#include +#include #include int main() { diff --git a/test/io5.c b/test/io5.c index e24b1db..36356cc 100644 --- a/test/io5.c +++ b/test/io5.c @@ -1,7 +1,7 @@ -#include "socket.h" -#include "io.h" -#include "buffer.h" -#include "ip6.h" +#include +#include +#include +#include #include int main() { diff --git a/test/iob.c b/test/iob.c index 4fae590..7c4c5ea 100644 --- a/test/iob.c +++ b/test/iob.c @@ -1,5 +1,5 @@ #include -#include "libowfat/iob.h" +#include #include #include diff --git a/test/iom.c b/test/iom.c index 2a69d22..2d85541 100644 --- a/test/iom.c +++ b/test/iom.c @@ -1,4 +1,4 @@ -#include "libowfat/io.h" +#include #include #if !defined(PTHREAD) && (defined(__dietlibc__) || defined(__linux__)) #define THRD diff --git a/test/iombench.c b/test/iombench.c new file mode 100644 index 0000000..19ae33c --- /dev/null +++ b/test/iombench.c @@ -0,0 +1,127 @@ +#include +#include +#if !defined(PTHREAD) && (defined(__dietlibc__) || defined(__linux__)) +#define THRD +#include +#else +#include +#endif +#include +#include + +iomux_t c; + +int worker(void* arg) { + uintptr_t i=(uintptr_t)arg; + char buf[100]; + int64 s; + unsigned int events; + int n=0; + + for (;;) { + switch (iom_wait(&c,&s,&events,1000)) { + case -1: + perror("iom_wait"); + return -1; + case 0: + write(1,buf,sprintf(buf,"timeout in thread %ld\n",i)); + return 0; + case 1: + break; + } + switch (read(s,buf,1)) { + case -1: + perror("read"); + return -1; + case 0: + return n; + } +// write(1,".",1); + ++n; + if (iom_requeue(&c,s,IOM_READ)==-1) { + perror("iom_requeue"); + return 1; + } + } + + return 0; +} + +#ifndef THRD +void* workerwrapper(void* arg) { + return (void*)(uintptr_t)worker(arg); +} +#endif + +enum { nfd=10, nthrd=4 }; + +int main() { + int i; + int fd[2*nfd]; + for (i=0; i #include -#include +#include int main() { char buf[100]; diff --git a/test/marshal.c b/test/marshal.c index 1a5b757..1a70fa8 100644 --- a/test/marshal.c +++ b/test/marshal.c @@ -3,18 +3,18 @@ #include #include -#include "fmt.h" -#include "stralloc.h" -#include "buffer.h" -#include "scan.h" -#include -#include -#include -#include -#include -#include -#include -#include "str.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include char buf[100]; stralloc sa; diff --git a/test/mult.c b/test/mult.c index b96b489..e0c9949 100644 --- a/test/mult.c +++ b/test/mult.c @@ -1,5 +1,5 @@ #include -#include "safemult.h" +#include int main() { int16 a; diff --git a/test/netstring.c b/test/netstring.c index 7b5d0c2..1c38088 100644 --- a/test/netstring.c +++ b/test/netstring.c @@ -1,7 +1,8 @@ -#include "fmt.h" -#include "scan.h" +#include +#include #include #include +#include int main() { char buf[100]; diff --git a/test/protobuf.c b/test/protobuf.c index 96da1d1..58e736c 100644 --- a/test/protobuf.c +++ b/test/protobuf.c @@ -1,5 +1,5 @@ -#include "fmt.h" -#include "scan.h" +#include +#include #include #include #include diff --git a/test/proxy.c b/test/proxy.c index be9f348..135d7d7 100644 --- a/test/proxy.c +++ b/test/proxy.c @@ -1,12 +1,12 @@ -#include "socket.h" -#include "io.h" -#include "buffer.h" -#include "ip6.h" -#include "str.h" -#include "dns.h" +#include +#include +#include +#include +#include +#include #include #include -#include "scan.h" +#include #include struct state { diff --git a/test/range.c b/test/range.c index ef16b59..4cdb7e0 100644 --- a/test/range.c +++ b/test/range.c @@ -1,4 +1,4 @@ -#include "rangecheck.h" +#include #include #include #include diff --git a/test/readhttp.c b/test/readhttp.c index 1dff650..bb14b3f 100644 --- a/test/readhttp.c +++ b/test/readhttp.c @@ -1,6 +1,6 @@ -#include "stralloc.h" -#include "buffer.h" -#include "byte.h" +#include +#include +#include /* this demonstrates the buffer_get_token_sa_pred interface; * ishttp is the predicate that determines when buffer_get_token_sa_pred diff --git a/test/scan.c b/test/scan.c index ead109e..a3d0310 100644 --- a/test/scan.c +++ b/test/scan.c @@ -1,6 +1,6 @@ #include #include -#include "scan.h" +#include int main() { unsigned long l; diff --git a/test/scan_long.c b/test/scan_long.c index a364a5d..d3fcf26 100644 --- a/test/scan_long.c +++ b/test/scan_long.c @@ -1,6 +1,6 @@ -#include "scan.h" -#include "fmt.h" -#include "buffer.h" +#include +#include +#include #include int main() { diff --git a/test/server.c b/test/server.c index f5e66be..cf37c88 100644 --- a/test/server.c +++ b/test/server.c @@ -1,12 +1,12 @@ -#include "scan.h" -#include "ip6.h" -#include "str.h" +#include +#include +#include #include #include #include #include -#include "socket.h" -#include "ndelay.h" +#include +#include #include #ifdef __dietlibc__ #include diff --git a/test/stralloc_buffer.c b/test/stralloc_buffer.c index dda6dd3..f18f7c5 100644 --- a/test/stralloc_buffer.c +++ b/test/stralloc_buffer.c @@ -1,5 +1,5 @@ -#include "stralloc.h" -#include "buffer.h" +#include +#include int main() { static stralloc sa; diff --git a/test/stralloc_chomp.c b/test/stralloc_chomp.c index 890ca5e..2e6b776 100644 --- a/test/stralloc_chomp.c +++ b/test/stralloc_chomp.c @@ -1,6 +1,6 @@ #include -#include "stralloc.h" -#include "buffer.h" +#include +#include int main() { static stralloc sa; diff --git a/test/textcode.c b/test/textcode.c index 90244b8..3f976cd 100644 --- a/test/textcode.c +++ b/test/textcode.c @@ -1,10 +1,9 @@ -#include "array.h" -#include "textcode.h" +#include +#include #include #include #include #include -#include array a; diff --git a/test/unurl.c b/test/unurl.c index 4863c4e..971fdfa 100644 --- a/test/unurl.c +++ b/test/unurl.c @@ -1,6 +1,6 @@ #include -#include "buffer.h" -#include "textcode.h" +#include +#include #include "havealloca.h" #include #include diff --git a/test/urlencode.c b/test/urlencode.c index 251befb..cca2532 100644 --- a/test/urlencode.c +++ b/test/urlencode.c @@ -1,6 +1,6 @@ #include -#include "buffer.h" -#include "textcode.h" +#include +#include #include "havealloca.h" #include diff --git a/test/utf8.c b/test/utf8.c index 20047aa..00e71e0 100644 --- a/test/utf8.c +++ b/test/utf8.c @@ -1,6 +1,6 @@ #include -#include "scan.h" -#include "fmt.h" +#include +#include /* http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt */ diff --git a/test/uudecode.c b/test/uudecode.c index 2ce876a..33e8632 100644 --- a/test/uudecode.c +++ b/test/uudecode.c @@ -6,17 +6,16 @@ * when decoding a part with broken crc. */ #include #include -#include #include #include #include -#include "libowfat/textcode.h" -#include "libowfat/str.h" -#include "libowfat/buffer.h" -#include "libowfat/open.h" -#include "libowfat/stralloc.h" -#include "libowfat/scan.h" -#include "libowfat/case.h" +#include +#include +#include +#include +#include +#include +#include static const uint32_t crc_table[256] = { 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, diff --git a/test/vd.c b/test/vd.c index ac6d5f9..5d06da7 100644 --- a/test/vd.c +++ b/test/vd.c @@ -1,9 +1,8 @@ -#include "socket.h" -#include "buffer.h" +#include +#include #include #include #include -#include "ndelay.h" int main(int argc,char* argv[]) { int s=socket_tcp4b();