great include cleanup
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#include "likely.h"
|
||||
#include <libowfat/compiler.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include "safemult.h"
|
||||
#include "array.h"
|
||||
#include "byte.h"
|
||||
#include <libowfat/safemult.h>
|
||||
#include <libowfat/array.h>
|
||||
#include <libowfat/byte.h>
|
||||
|
||||
#if 0
|
||||
static array x;
|
||||
@@ -46,26 +46,26 @@
|
||||
|
||||
void* array_allocate(array* x,uint64 membersize,int64 pos) {
|
||||
uint64 wanted;
|
||||
if (__unlikely(x->allocated<0)) return 0; /* array is failed */
|
||||
if (__unlikely(pos+1<1)) return 0;
|
||||
if (unlikely(x->allocated<0)) return 0; /* array is failed */
|
||||
if (unlikely(pos+1<1)) return 0;
|
||||
/* second case of overflow: pos*membersize too large */
|
||||
if (__unlikely(!umult64(membersize,pos+1,&wanted))) return 0;
|
||||
if (unlikely(!umult64(membersize,pos+1,&wanted))) return 0;
|
||||
|
||||
if (wanted > (uint64)x->initialized) {
|
||||
if (__unlikely(wanted >= (uint64)x->allocated)) {
|
||||
if (unlikely(wanted >= (uint64)x->allocated)) {
|
||||
/* round up a little */
|
||||
if (membersize<8)
|
||||
wanted=(wanted+127)&(-128ll); /* round up to multiple of 128 */
|
||||
else
|
||||
wanted=(wanted+4095)&(-4096ll); /* round up to 4k pages */
|
||||
|
||||
if (__unlikely(wanted<128)) return 0; /* overflow during rounding */
|
||||
if (unlikely(wanted<128)) return 0; /* overflow during rounding */
|
||||
|
||||
if (sizeof(size_t) != sizeof(int64) && __unlikely((size_t)(wanted) != wanted))
|
||||
if (sizeof(size_t) != sizeof(int64) && unlikely((size_t)(wanted) != wanted))
|
||||
return 0;
|
||||
{
|
||||
char* tmp=realloc(x->p,wanted);
|
||||
if (__unlikely(!tmp)) return 0;
|
||||
if (unlikely(!tmp)) return 0;
|
||||
x->p=tmp;
|
||||
}
|
||||
x->allocated=wanted;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
|
||||
int64 array_bytes(const array* const x) {
|
||||
if (x->allocated<0) return -1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "array.h"
|
||||
#include "byte.h"
|
||||
#include <libowfat/array.h>
|
||||
#include <libowfat/byte.h>
|
||||
|
||||
void array_cat(array* to,const array* const from) {
|
||||
if (from->allocated<0) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
|
||||
void array_cat0(array* to) {
|
||||
static char zero;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "array.h"
|
||||
#include "byte.h"
|
||||
#include <libowfat/array.h>
|
||||
#include <libowfat/byte.h>
|
||||
|
||||
void array_catb(array* to,const char* from,uint64 len) {
|
||||
long l;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
|
||||
void array_cate(array* to,const array* const from,int64 pos,int64 stop) {
|
||||
if (pos<0 || stop<pos) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "array.h"
|
||||
#include "str.h"
|
||||
#include <libowfat/array.h>
|
||||
#include <libowfat/str.h>
|
||||
|
||||
void array_cats(array* to,const char* from) {
|
||||
array_catb(to,from,str_len(from));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "array.h"
|
||||
#include "str.h"
|
||||
#include <libowfat/array.h>
|
||||
#include <libowfat/str.h>
|
||||
|
||||
void array_cats0(array* to,const char* from) {
|
||||
array_catb(to,from,str_len(from)+1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "byte.h"
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
#include <libowfat/byte.h>
|
||||
|
||||
int array_equal(const array* const x,const array* const y) {
|
||||
if (x->initialized!=y->initialized) return 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
|
||||
void array_fail(array* x) {
|
||||
if (x->p) free(x->p);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "likely.h"
|
||||
#include "safemult.h"
|
||||
#include "array.h"
|
||||
#include <libowfat/compiler.h>
|
||||
#include <libowfat/safemult.h>
|
||||
#include <libowfat/array.h>
|
||||
|
||||
#if 0
|
||||
static array x;
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
void* array_get(const array* const x,uint64 membersize,int64 pos) {
|
||||
uint64 wanted;
|
||||
if (__unlikely(pos+1<1)) return 0;
|
||||
if (__unlikely(!umult64(membersize,pos,&wanted))) return 0;
|
||||
if (unlikely(pos+1<1)) return 0;
|
||||
if (unlikely(!umult64(membersize,pos,&wanted))) return 0;
|
||||
|
||||
if (__unlikely((int64)wanted >= x->allocated || wanted>=x->initialized)) return 0;
|
||||
if (unlikely((int64)wanted >= x->allocated || wanted>=x->initialized)) return 0;
|
||||
return (void*)(x->p+pos*membersize);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
|
||||
int64 array_length(const array* const x,uint64 membersize) {
|
||||
if (x->allocated<0) return -1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
|
||||
void array_reset(array* x) {
|
||||
if (x->p) free(x->p);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
|
||||
void* array_start(const array* const x) {
|
||||
return x->p;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "array.h"
|
||||
#include <libowfat/array.h>
|
||||
|
||||
void array_trunc(array* x) {
|
||||
x->initialized=0;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "likely.h"
|
||||
#include "safemult.h"
|
||||
#include "array.h"
|
||||
#include <libowfat/compiler.h>
|
||||
#include <libowfat/safemult.h>
|
||||
#include <libowfat/array.h>
|
||||
|
||||
/* I'm not sure I understand what this function is good for */
|
||||
void array_truncate(array* x,uint64 membersize,int64 len) {
|
||||
uint64 wanted;
|
||||
if (__unlikely(len<0)) return;
|
||||
if (__unlikely(!umult64(membersize,len,&wanted))) return;
|
||||
if (__unlikely(wanted > x->initialized)) return;
|
||||
if (unlikely(len<0)) return;
|
||||
if (unlikely(!umult64(membersize,len,&wanted))) return;
|
||||
if (unlikely(wanted > x->initialized)) return;
|
||||
x->initialized=wanted;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#include "likely.h"
|
||||
#include <stdlib.h>
|
||||
#ifndef _WIN32
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "iarray.h"
|
||||
#include <libowfat/iarray.h>
|
||||
#ifdef __dietlibc__
|
||||
#include <sys/atomic.h>
|
||||
#else
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "iarray.h"
|
||||
#include <libowfat/iarray.h>
|
||||
|
||||
static void freechain(iarray_page* p,size_t pagesize) {
|
||||
while (p) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "iarray.h"
|
||||
#include <libowfat/iarray.h>
|
||||
|
||||
void* iarray_get(iarray* ia,size_t pos) {
|
||||
size_t index;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "iarray.h"
|
||||
#include <libowfat/iarray.h>
|
||||
|
||||
void iarray_init(iarray* ia,size_t elemsize) {
|
||||
size_t i;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "iarray.h"
|
||||
#include <libowfat/iarray.h>
|
||||
|
||||
size_t iarray_length(iarray* ia) {
|
||||
return ia->len;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "byte.h"
|
||||
#include "buffer.h"
|
||||
#include "scan.h"
|
||||
#include <libowfat/byte.h>
|
||||
#include <libowfat/buffer.h>
|
||||
|
||||
#include <string.h> /* for memccpy */
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "byte.h"
|
||||
#include "buffer.h"
|
||||
#include "scan.h"
|
||||
#include <libowfat/byte.h>
|
||||
#include <libowfat/buffer.h>
|
||||
|
||||
ssize_t buffer_get_token_pred(buffer* b,char* x,size_t len,
|
||||
string_predicate p) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "buffer.h"
|
||||
#include "fmt.h"
|
||||
#include <libowfat/buffer.h>
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
int buffer_put8long(buffer *b,unsigned long l) {
|
||||
char buf[FMT_8LONG];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "buffer.h"
|
||||
#include "fmt.h"
|
||||
#include <libowfat/buffer.h>
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
int buffer_putlong(buffer *b,signed long l) {
|
||||
char buf[FMT_LONG];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "buffer.h"
|
||||
#include "fmt.h"
|
||||
#include <libowfat/buffer.h>
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
int buffer_putlonglong(buffer *b,signed long long l) {
|
||||
char buf[FMT_LONG];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "buffer.h"
|
||||
#include "fmt.h"
|
||||
#include <libowfat/buffer.h>
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
int buffer_putulong(buffer *b,unsigned long l) {
|
||||
char buf[FMT_ULONG];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "buffer.h"
|
||||
#include "fmt.h"
|
||||
#include <libowfat/buffer.h>
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
int buffer_putulonglong(buffer *b,unsigned long long l) {
|
||||
char buf[FMT_ULONG];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "buffer.h"
|
||||
#include "fmt.h"
|
||||
#include <libowfat/buffer.h>
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
int buffer_putxlong(buffer *b,unsigned long l) {
|
||||
char buf[FMT_XLONG];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "case.h"
|
||||
#include <libowfat/case.h>
|
||||
|
||||
int case_diffb(register const void* S,register size_t len,register const void* T)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "case.h"
|
||||
#include <libowfat/case.h>
|
||||
|
||||
int case_diffs(register const char *s,register const char *t)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "case.h"
|
||||
#include <libowfat/case.h>
|
||||
|
||||
void case_lowerb(void *S,size_t len) {
|
||||
char* s=(char*)S;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "case.h"
|
||||
#include <libowfat/case.h>
|
||||
|
||||
void case_lowers(char *s) {
|
||||
unsigned char x;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "case.h"
|
||||
#include <libowfat/case.h>
|
||||
|
||||
/* str_start returns 1 if the b is a prefix of a, 0 otherwise */
|
||||
int case_starts(const char* a, const char* b) {
|
||||
|
||||
5
fmt.h
5
fmt.h
@@ -260,6 +260,11 @@ size_t fmt_netstring(char* dest,const char* src,size_t len) noexcept;
|
||||
att_write(1)
|
||||
size_t fmt_escapecharxml(char* dest,uint32_t ch) noexcept;
|
||||
|
||||
/* XML escaping but only for necessary codepoints.
|
||||
* Others emitted as UTF-8 */
|
||||
att_write(1)
|
||||
size_t fmt_xmlescape(char* dest,uint32_t ch) noexcept;
|
||||
|
||||
/* HTML escaping is the same as XML escaping. */
|
||||
att_write(1)
|
||||
size_t fmt_escapecharhtml(char* dest,uint32_t ch) noexcept;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_8long(char *dest,unsigned long i) {
|
||||
register unsigned long len,tmp;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_8longlong(char *dest,unsigned long long i) {
|
||||
register unsigned long len;
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
static size_t asn1derlengthbytesneeded(unsigned long long l) {
|
||||
size_t needed;
|
||||
for (needed=1; (l>>=8)>0; ++needed) ;
|
||||
return needed;
|
||||
}
|
||||
|
||||
/* write int in least amount of bytes, return number of bytes */
|
||||
/* as used in ASN.1 length */
|
||||
size_t fmt_asn1derlength(char* dest,unsigned long long l) {
|
||||
/* encoding is either l%128 or (0x80+number of bytes,bytes) */
|
||||
size_t needed=(sizeof l),i;
|
||||
size_t i;
|
||||
if (l<128) {
|
||||
if (dest) *dest=l&0x7f;
|
||||
return 1;
|
||||
}
|
||||
for (i=1; i<needed; ++i)
|
||||
for (i=1; i<sizeof l; ++i)
|
||||
if (!(l>>(i*8)))
|
||||
break;
|
||||
if (dest) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
/* write int in least amount of bytes, return number of bytes */
|
||||
/* as used in ASN.1 DER tag */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_double(char *dest, double d,int maxlen,int prec) {
|
||||
union {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
#ifdef UNITTEST
|
||||
#include "fmt_tohex.c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
#ifdef UNITTEST
|
||||
#undef UNITTEST
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_escapecharquotedprintableutf8(char* dest,uint32_t ch) {
|
||||
char buf[FMT_UTF8];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_escapecharxml(char* dest,uint32_t ch) {
|
||||
char a[FMT_LONG], b[FMT_XLONG+1];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
/* "foo" -> "foo "
|
||||
* append padlen-srclen spaces after dest, if that is >= 0. Truncate
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "byte.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/byte.h>
|
||||
#include <time.h>
|
||||
|
||||
static unsigned int fmt_2digits(char* dest,int i) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_human(char* dest,unsigned long long l) {
|
||||
char unit;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_humank(char* dest,unsigned long long l) {
|
||||
char unit;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "byte.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/byte.h>
|
||||
#include <time.h>
|
||||
|
||||
static unsigned int fmt_2digits(char* dest,int i) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_long(char *dest,long int i) {
|
||||
if (i<0) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_longlong(char *dest,signed long long int i) {
|
||||
if (i<0) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_minus(char *dest,int i) {
|
||||
if (i<0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "rangecheck.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/rangecheck.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t fmt_netstring(char* dest,const char* src,size_t len) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
/* "foo" -> " foo"
|
||||
* write padlen-srclen spaces, if that is >= 0. Then copy srclen
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_pb_double(char* dest,size_t fieldno,double d) {
|
||||
size_t n=fmt_pb_tag(dest,fieldno,1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_pb_float(char* dest,size_t fieldno,float f) {
|
||||
size_t n=fmt_pb_tag(dest,fieldno,5);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_pb_int(char* dest,size_t fieldno,unsigned long long l) {
|
||||
size_t n=fmt_pb_tag(dest,fieldno,0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_pb_sint(char* dest,size_t fieldno,signed long long l) {
|
||||
size_t n=fmt_pb_tag(dest,fieldno,0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "rangecheck.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/rangecheck.h>
|
||||
|
||||
size_t fmt_pb_string(char* dest,size_t fieldno,const char* s,size_t l) {
|
||||
size_t n=fmt_pb_tag(dest,fieldno,2);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_pb_tag(char* dest,size_t fieldno,unsigned char type) {
|
||||
if (type>5 || (fieldno >> (sizeof(fieldno)*8-3))) return 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_pb_type0_sint(char* dest,signed long long l) {
|
||||
return fmt_varint(dest,(l << 1) ^ (l >> (sizeof(l)*8-1)));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "compiletimeassert.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/compiletimeassert.h>
|
||||
|
||||
size_t fmt_pb_type1_double(char* dest,double d) {
|
||||
union {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "uint64.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/uint64.h>
|
||||
|
||||
size_t fmt_pb_type1_fixed64(char* dest,uint64_t l) {
|
||||
if (dest) uint64_pack(dest,l);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "rangecheck.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/rangecheck.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t fmt_pb_type2_string(char* dest,const char* s,size_t l) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "uint32.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/uint32.h>
|
||||
|
||||
size_t fmt_pb_type5_fixed32(char* dest,uint32_t l) {
|
||||
if (dest) uint32_pack(dest,l);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "fmt.h"
|
||||
#include "compiletimeassert.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <libowfat/compiletimeassert.h>
|
||||
|
||||
size_t fmt_pb_type5_float(char* dest,float f) {
|
||||
union {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_plusminus(char *dest,int i) {
|
||||
if (i) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_str(char *out,const char *in) {
|
||||
register char* s=out;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <stdarg.h>
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_strm_internal(char* dest, ...) {
|
||||
size_t n;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_strn(char *out,const char *in,size_t limit) {
|
||||
register char* s=out;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
char fmt_tohex(char c) {
|
||||
return (char)(c>=10?c-10+'a':c+'0');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_ulong(char *dest,unsigned long i) {
|
||||
register unsigned long len,tmp,len2;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_ulong0(char *dest,unsigned long i,size_t pad) {
|
||||
register unsigned int len;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
size_t fmt_ulonglong(char *dest,unsigned long long int i) {
|
||||
register unsigned long len;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
/* write int in least amount of bytes, return number of bytes */
|
||||
/* as used in varints from Google protocol buffers */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include "haveinline.h"
|
||||
|
||||
static inline char tohex(char c) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
static inline char tohex(char c) {
|
||||
return (char)(c>=10?c-10+'a':c+'0');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
|
||||
/* This is NOT fmt_escapexml, which will escape everything, whether it
|
||||
/* This is NOT fmt_escapecharxml, which will escape everything, whether it
|
||||
* needs escaping or not. This will only escape what needs escaping, and
|
||||
* reject invalid inputs */
|
||||
size_t fmt_xmlescape(char* dest,uint32_t ch) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "io_internal.h"
|
||||
#include <iarray.h>
|
||||
#include <libowfat/iarray.h>
|
||||
#include <time.h>
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
unsigned int io_debugstring(int64 s,char* buf,unsigned int bufsize) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef __dietlibc__
|
||||
#include "fmt.h"
|
||||
#include <libowfat/fmt.h>
|
||||
#include <write12.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#define my_extern extern
|
||||
#endif
|
||||
|
||||
#include "libowfat/io.h"
|
||||
#include "libowfat/array.h"
|
||||
#include "libowfat/iarray.h"
|
||||
#include <libowfat/io.h>
|
||||
#include <libowfat/array.h>
|
||||
#include <libowfat/iarray.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <winsock2.h>
|
||||
#include "socket.h"
|
||||
#include <libowfat/socket.h>
|
||||
my_extern HANDLE io_comport;
|
||||
#else
|
||||
#include "haveepoll.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "iob.h"
|
||||
#include "array.h"
|
||||
#include <libowfat/iob.h>
|
||||
#include <libowfat/array.h>
|
||||
|
||||
typedef struct iob_entry {
|
||||
enum { FROMBUF, FROMFILE } type;
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef struct {
|
||||
#define IOPAUSE_READ 1
|
||||
#define IOPAUSE_WRITE 4
|
||||
|
||||
#include "taia.h"
|
||||
#include <libowfat/taia.h>
|
||||
|
||||
extern void iopause(iopause_fd *,unsigned int,struct taia *,struct taia *);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef struct pollfd iopause_fd;
|
||||
#define IOPAUSE_READ POLLIN
|
||||
#define IOPAUSE_WRITE POLLOUT
|
||||
|
||||
#include "taia.h"
|
||||
#include <libowfat/taia.h>
|
||||
|
||||
extern void iopause(iopause_fd *,unsigned int,struct taia *,struct taia *);
|
||||
|
||||
|
||||
2
ip4.h
2
ip4.h
@@ -6,6 +6,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
size_t scan_ip4(const char *src,char ip[4]);
|
||||
size_t fmt_ip4(char *dest,const char ip[4]);
|
||||
|
||||
|
||||
2
likely.h
2
likely.h
@@ -1,3 +1,5 @@
|
||||
// no longer needed. Use likely and unlikely from libowfat/compiler.h
|
||||
|
||||
#ifdef __dietlibc__
|
||||
#include <sys/cdefs.h>
|
||||
#else
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/* for ssize_t */
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "stralloc.h"
|
||||
#include <libowfat/stralloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
size_t scan_8int(const char* src,unsigned int* dest) {
|
||||
/* make a copy of src so we can return the number of bytes we progressed */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
#ifdef UNITTEST
|
||||
#undef UNITTEST
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
size_t scan_8longlong(const char *src,unsigned long long *dest) {
|
||||
/* make a copy of src so we can return the number of bytes we progressed */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
size_t scan_8longn(const char *src,size_t n,unsigned long *dest) {
|
||||
/* make a copy of src so we can return the number of bytes we progressed */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
size_t scan_8short(const char* src,unsigned short* dest) {
|
||||
/* make a copy of src so we can return the number of bytes we progressed */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <ctype.h>
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
/* Return the number of leading chars in s that are in charset, but no
|
||||
* more than limit */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
static inline int isdigit(int c) { return (c>='0' && c<='9'); }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
int scan_fromhex(unsigned char c) {
|
||||
c=(unsigned char)(c-'0');
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#ifdef __dietlibc__
|
||||
#define __deprecated__
|
||||
#endif
|
||||
#include "scan.h"
|
||||
#include "byte.h"
|
||||
#include "case.h"
|
||||
#include <libowfat/scan.h>
|
||||
#include <libowfat/byte.h>
|
||||
#include <libowfat/case.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
static const unsigned int maxint = ((unsigned int)-1)>>1;
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
#ifdef __dietlibc__
|
||||
#define __deprecated__
|
||||
#endif
|
||||
#include "scan.h"
|
||||
#include "byte.h"
|
||||
#include "case.h"
|
||||
#include <libowfat/scan.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
#ifdef UNITTEST
|
||||
#undef UNITTEST
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scan.h"
|
||||
#include <libowfat/scan.h>
|
||||
|
||||
static const unsigned long maxlong = ((unsigned long)-1)>>1;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user