Browse Source

remove obsolete extern from header files

master
Felix von Leitner 18 years ago
parent
commit
047b6400fc
  1. 1
      CHANGES
  2. 10
      case.h
  3. 78
      dns.h
  4. 4
      ip4.h
  5. 8
      ip6.h
  6. 6
      mmap.h
  7. 4
      ndelay.h
  8. 10
      open.h
  9. 2
      openreadclose.h
  10. 4
      readclose.h
  11. 46
      scan.h
  12. 72
      socket.h
  13. 14
      str.h
  14. 44
      stralloc.h
  15. 12
      tai.h
  16. 18
      uint16.h
  17. 18
      uint32.h

1
CHANGES

@ -7,6 +7,7 @@
function itself
add buffer functions to write strerror(errno)
add io API supporting poll, epoll and kqueue
remove obsolete "extern" from header files
0.15:
man page update (document stralloc return values)

10
case.h

@ -2,17 +2,17 @@
#define CASE_H
/* turn upper case letters to lower case letters, ASCIIZ */
extern void case_lowers(char *s);
void case_lowers(char *s);
/* turn upper case letters to lower case letters, binary */
extern void case_lowerb(void *buf,unsigned long len);
void case_lowerb(void *buf,unsigned long len);
/* like str_diff, ignoring case */
extern int case_diffs(const char *,const char *);
int case_diffs(const char *,const char *);
/* like byte_diff, ignoring case */
extern int case_diffb(const void *,unsigned long,const void *);
int case_diffb(const void *,unsigned long,const void *);
/* like str_start, ignoring case */
extern int case_starts(const char *,const char *);
int case_starts(const char *,const char *);
#define case_equals(s,t) (!case_diffs((s),(t)))
#define case_equalb(s,n,t) (!case_diffb((s),(n),(t)))

78
dns.h

@ -40,54 +40,54 @@ struct dns_transmit {
char qtype[2];
} ;
extern void dns_random_init(const char *);
extern unsigned int dns_random(unsigned int);
void dns_random_init(const char *);
unsigned int dns_random(unsigned int);
extern void dns_sortip(char *,unsigned int);
extern void dns_sortip6(char *,unsigned int);
void dns_sortip(char *,unsigned int);
void dns_sortip6(char *,unsigned int);
extern void dns_domain_free(char **);
extern int dns_domain_copy(char **,const char *);
extern unsigned int dns_domain_length(const char *);
extern int dns_domain_equal(const char *,const char *);
extern int dns_domain_suffix(const char *,const char *);
extern unsigned int dns_domain_suffixpos(const char *,const char *);
extern int dns_domain_fromdot(char **,const char *,unsigned int);
extern int dns_domain_todot_cat(stralloc *,const char *);
void dns_domain_free(char **);
int dns_domain_copy(char **,const char *);
unsigned int dns_domain_length(const char *);
int dns_domain_equal(const char *,const char *);
int dns_domain_suffix(const char *,const char *);
unsigned int dns_domain_suffixpos(const char *,const char *);
int dns_domain_fromdot(char **,const char *,unsigned int);
int dns_domain_todot_cat(stralloc *,const char *);
extern unsigned int dns_packet_copy(const char *,unsigned int,unsigned int,char *,unsigned int);
extern unsigned int dns_packet_getname(const char *,unsigned int,unsigned int,char **);
extern unsigned int dns_packet_skipname(const char *,unsigned int,unsigned int);
unsigned int dns_packet_copy(const char *,unsigned int,unsigned int,char *,unsigned int);
unsigned int dns_packet_getname(const char *,unsigned int,unsigned int,char **);
unsigned int dns_packet_skipname(const char *,unsigned int,unsigned int);
extern int dns_transmit_start(struct dns_transmit *,const char *,int,const char *,const char *,const char *);
extern void dns_transmit_free(struct dns_transmit *);
extern void dns_transmit_io(struct dns_transmit *,iopause_fd *,struct taia *);
extern int dns_transmit_get(struct dns_transmit *,const iopause_fd *,const struct taia *);
int dns_transmit_start(struct dns_transmit *,const char *,int,const char *,const char *,const char *);
void dns_transmit_free(struct dns_transmit *);
void dns_transmit_io(struct dns_transmit *,iopause_fd *,struct taia *);
int dns_transmit_get(struct dns_transmit *,const iopause_fd *,const struct taia *);
extern int dns_resolvconfip(char *);
extern int dns_resolve(const char *,const char *);
extern struct dns_transmit dns_resolve_tx;
int dns_resolvconfip(char *);
int dns_resolve(const char *,const char *);
struct dns_transmit dns_resolve_tx;
extern int dns_ip4_packet(stralloc *,const char *,unsigned int);
extern int dns_ip4(stralloc *,const stralloc *);
extern int dns_ip6_packet(stralloc *,const char *,unsigned int);
extern int dns_ip6(stralloc *,stralloc *);
extern int dns_name_packet(stralloc *,const char *,unsigned int);
extern void dns_name4_domain(char *,const char *);
int dns_ip4_packet(stralloc *,const char *,unsigned int);
int dns_ip4(stralloc *,const stralloc *);
int dns_ip6_packet(stralloc *,const char *,unsigned int);
int dns_ip6(stralloc *,stralloc *);
int dns_name_packet(stralloc *,const char *,unsigned int);
void dns_name4_domain(char *,const char *);
#define DNS_NAME4_DOMAIN 31
extern int dns_name4(stralloc *,const char *);
extern int dns_txt_packet(stralloc *,const char *,unsigned int);
extern int dns_txt(stralloc *,const stralloc *);
extern int dns_mx_packet(stralloc *,const char *,unsigned int);
extern int dns_mx(stralloc *,const stralloc *);
int dns_name4(stralloc *,const char *);
int dns_txt_packet(stralloc *,const char *,unsigned int);
int dns_txt(stralloc *,const stralloc *);
int dns_mx_packet(stralloc *,const char *,unsigned int);
int dns_mx(stralloc *,const stralloc *);
extern int dns_resolvconfrewrite(stralloc *);
extern int dns_ip4_qualify_rules(stralloc *,stralloc *,const stralloc *,const stralloc *);
extern int dns_ip4_qualify(stralloc *,stralloc *,const stralloc *);
extern int dns_ip6_qualify_rules(stralloc *,stralloc *,const stralloc *,const stralloc *);
extern int dns_ip6_qualify(stralloc *,stralloc *,const stralloc *);
int dns_resolvconfrewrite(stralloc *);
int dns_ip4_qualify_rules(stralloc *,stralloc *,const stralloc *,const stralloc *);
int dns_ip4_qualify(stralloc *,stralloc *,const stralloc *);
int dns_ip6_qualify_rules(stralloc *,stralloc *,const stralloc *,const stralloc *);
int dns_ip6_qualify(stralloc *,stralloc *,const stralloc *);
extern int dns_name6_domain(char *,char *);
int dns_name6_domain(char *,char *);
#define DNS_NAME6_DOMAIN (4*16+10)
#endif

4
ip4.h

@ -1,8 +1,8 @@
#ifndef IP4_H
#define IP4_H
extern unsigned int scan_ip4(const char *src,char *ip);
extern unsigned int fmt_ip4(char *dest,const char *ip);
unsigned int scan_ip4(const char *src,char *ip);
unsigned int fmt_ip4(char *dest,const char *ip);
/* for djb backwards compatibility */
#define ip4_scan scan_ip4

8
ip6.h

@ -3,11 +3,11 @@
#include "byte.h"
extern unsigned int scan_ip6(const char *src,char *ip);
extern unsigned int fmt_ip6(char *dest,const char *ip);
unsigned int scan_ip6(const char *src,char *ip);
unsigned int fmt_ip6(char *dest,const char *ip);
extern unsigned int scan_ip6_flat(const char *src,char *);
extern unsigned int fmt_ip6_flat(char *dest,const char *);
unsigned int scan_ip6_flat(const char *src,char *);
unsigned int fmt_ip6_flat(char *dest,const char *);
/*
ip6 address syntax: (h = hex digit), no leading '0' required

6
mmap.h

@ -3,15 +3,15 @@
/* open file for reading, mmap whole file, close file, write length of
* map in filesize and return pointer to map. */
extern char* mmap_read(const char *filename,unsigned long* filesize);
char* mmap_read(const char *filename,unsigned long* filesize);
/* open file for writing, mmap whole file privately (copy on write),
* close file, write length of map in filesize and return pointer to
* map. */
extern char* mmap_private(const char *filename,unsigned long* filesize);
char* mmap_private(const char *filename,unsigned long* filesize);
/* open file for writing, mmap whole file shared, close file, write
* length of map in filesize and return pointer to map. */
extern char* mmap_shared(const char *filename,unsigned long* filesize);
char* mmap_shared(const char *filename,unsigned long* filesize);
#endif

4
ndelay.h

@ -1,7 +1,7 @@
#ifndef NDELAY_H
#define NDELAY_H
extern int ndelay_on(int);
extern int ndelay_off(int);
int ndelay_on(int);
int ndelay_off(int);
#endif

10
open.h

@ -2,26 +2,26 @@
#define OPEN_H
/* open filename for reading and return the file handle or -1 on error */
extern int open_read(const char *filename);
int open_read(const char *filename);
/* create filename for exclusive write only use (mode 0600) and return
* the file handle or -1 on error */
extern int open_excl(const char *filename);
int open_excl(const char *filename);
/* open filename for appending write only use (mode 0600)
* and return the file handle or -1 on error.
* All write operation will append after the last byte, regardless of
* seeking or other processes also appending to the file. The file will
* be created if it does not exist. */
extern int open_append(const char *filename);
int open_append(const char *filename);
/* open filename for writing (mode 0644). Create the file if it does
* not exist, truncate it to zero length otherwise. Return the file
* handle or -1 on error. */
extern int open_trunc(const char *filename);
int open_trunc(const char *filename);
/* open filename for writing. Create the file if it does not exist.
* Return the file handle or -1 on error. */
extern int open_write(const char *filename);
int open_write(const char *filename);
#endif

2
openreadclose.h

@ -3,6 +3,6 @@
#include "stralloc.h"
extern int openreadclose(const char *filename,stralloc *buf,unsigned int initiallength);
int openreadclose(const char *filename,stralloc *buf,unsigned int initiallength);
#endif

4
readclose.h

@ -3,7 +3,7 @@
#include "stralloc.h"
extern int readclose_append(int fd,stralloc *buf,unsigned int initlen);
extern int readclose(int fd,stralloc *buf,unsigned int initlen);
int readclose_append(int fd,stralloc *buf,unsigned int initlen);
int readclose(int fd,stralloc *buf,unsigned int initlen);
#endif

46
scan.h

@ -13,57 +13,57 @@
/* interpret src as ASCII decimal number, write number to dest and
* return the number of bytes that were parsed */
extern unsigned int scan_ulong(const char *src,unsigned long *dest);
unsigned int scan_ulong(const char *src,unsigned long *dest);
/* interpret src as ASCII hexadecimal number, write number to dest and
* return the number of bytes that were parsed */
extern unsigned int scan_xlong(const char *src,unsigned long *dest);
unsigned int scan_xlong(const char *src,unsigned long *dest);
/* interpret src as ASCII octal number, write number to dest and
* return the number of bytes that were parsed */
extern unsigned int scan_8long(const char *src,unsigned long *dest);
unsigned int scan_8long(const char *src,unsigned long *dest);
/* interpret src as signed ASCII decimal number, write number to dest
* and return the number of bytes that were parsed */
extern unsigned int scan_long(const char *src,signed long *dest);
unsigned int scan_long(const char *src,signed long *dest);
extern unsigned int scan_longlong(const char *src,signed long long *dest);
extern unsigned int scan_ulonglong(const char *src,unsigned long long *dest);
extern unsigned int scan_xlonglong(const char *src,unsigned long long *dest);
extern unsigned int scan_8longlong(const char *src,unsigned long long *dest);
unsigned int scan_longlong(const char *src,signed long long *dest);
unsigned int scan_ulonglong(const char *src,unsigned long long *dest);
unsigned int scan_xlonglong(const char *src,unsigned long long *dest);
unsigned int scan_8longlong(const char *src,unsigned long long *dest);
extern unsigned int scan_uint(const char *src,unsigned int *dest);
extern unsigned int scan_xint(const char *src,unsigned int *dest);
extern unsigned int scan_8int(const char *src,unsigned int *dest);
extern unsigned int scan_int(const char *src,signed int *dest);
unsigned int scan_uint(const char *src,unsigned int *dest);
unsigned int scan_xint(const char *src,unsigned int *dest);
unsigned int scan_8int(const char *src,unsigned int *dest);
unsigned int scan_int(const char *src,signed int *dest);
extern unsigned int scan_ushort(const char *src,unsigned short *dest);
extern unsigned int scan_xshort(const char *src,unsigned short *dest);
extern unsigned int scan_8short(const char *src,unsigned short *dest);
extern unsigned int scan_short(const char *src,signed short *dest);
unsigned int scan_ushort(const char *src,unsigned short *dest);
unsigned int scan_xshort(const char *src,unsigned short *dest);
unsigned int scan_8short(const char *src,unsigned short *dest);
unsigned int scan_short(const char *src,signed short *dest);
/* interpret src as double precision floating point number,
* write number to dest and return the number of bytes that were parsed */
extern unsigned int scan_double(const char *in, double *dest);
unsigned int scan_double(const char *in, double *dest);
/* if *src=='-', set *dest to -1 and return 1.
* if *src=='+', set *dest to 1 and return 1.
* otherwise set *dest to 1 return 0. */
extern unsigned int scan_plusminus(const char *src,signed int *dest);
unsigned int scan_plusminus(const char *src,signed int *dest);
/* return the highest integer n<=limit so that isspace(in[i]) for all 0<=i<=n */
extern unsigned long scan_whitenskip(const char *in,unsigned long limit) __pure__;
unsigned long scan_whitenskip(const char *in,unsigned long limit) __pure__;
/* return the highest integer n<=limit so that !isspace(in[i]) for all 0<=i<=n */
extern unsigned long scan_nonwhitenskip(const char *in,unsigned long limit) __pure__;
unsigned long scan_nonwhitenskip(const char *in,unsigned long limit) __pure__;
/* return the highest integer n<=limit so that in[i] is element of
* charset (ASCIIZ string) for all 0<=i<=n */
extern unsigned long scan_charsetnskip(const char *in,const char *charset,unsigned long limit) __pure__;
unsigned long scan_charsetnskip(const char *in,const char *charset,unsigned long limit) __pure__;
/* return the highest integer n<=limit so that in[i] is not element of
* charset (ASCIIZ string) for all 0<=i<=n */
extern unsigned long scan_noncharsetnskip(const char *in,const char *charset,unsigned long limit) __pure__;
unsigned long scan_noncharsetnskip(const char *in,const char *charset,unsigned long limit) __pure__;
/* try to parse ASCII GMT date; does not understand time zones. */
/* example dates:
@ -71,6 +71,6 @@ extern unsigned long scan_noncharsetnskip(const char *in,const char *charset,uns
* "Sunday, 06-Nov-94 08:49:37 GMT"
* "Sun Nov 6 08:49:37 1994"
*/
extern unsigned int scan_httpdate(const char *in,time_t *t) __pure__;
unsigned int scan_httpdate(const char *in,time_t *t) __pure__;
#endif

72
socket.h

@ -4,55 +4,55 @@
#include "uint16.h"
#include "uint32.h"
extern int socket_tcp4(void);
extern int socket_udp4(void);
extern int socket_tcp6(void);
extern int socket_udp6(void);
int socket_tcp4(void);
int socket_udp4(void);
int socket_tcp6(void);
int socket_udp6(void);
#define socket_tcp() socket_tcp4()
#define socket_udp() socket_udp4()
extern int socket_connect4(int s,const char* ip,uint16 port);
extern int socket_connect6(int s,const char* ip,uint16 port,uint32 scope_id);
extern int socket_connected(int s);
extern int socket_bind4(int s,const char* ip,uint16 port);
extern int socket_bind4_reuse(int s,const char* ip,uint16 port);
extern int socket_bind6(int s,const char* ip,uint16 port,uint32 scope_id);
extern int socket_bind6_reuse(int s,const char* ip,uint16 port,uint32 scope_id);
extern int socket_listen(int s,unsigned int backlog);
extern int socket_accept4(int s,char* ip,uint16* port);
extern int socket_accept6(int s,char* ip,uint16* port,uint32* scope_id);
extern int socket_recv4(int s,char* buf,unsigned int len,char* ip,uint16* port);
extern int socket_recv6(int s,char* buf,unsigned int len,char* ip,uint16* port,uint32* scope_id);
extern int socket_send4(int s,const char* buf,unsigned int len,const char* ip,uint16 port);
extern int socket_send6(int s,const char* buf,unsigned int len,const char* ip,uint16 port,uint32 scope_id);
extern int socket_local4(int s,char* ip,uint16* port);
extern int socket_local6(int s,char* ip,uint16* port,uint32* scope_id);
extern int socket_remote4(int s,char* ip,uint16* port);
extern int socket_remote6(int s,char* ip,uint16* port,uint32* scope_id);
int socket_connect4(int s,const char* ip,uint16 port);
int socket_connect6(int s,const char* ip,uint16 port,uint32 scope_id);
int socket_connected(int s);
int socket_bind4(int s,const char* ip,uint16 port);
int socket_bind4_reuse(int s,const char* ip,uint16 port);
int socket_bind6(int s,const char* ip,uint16 port,uint32 scope_id);
int socket_bind6_reuse(int s,const char* ip,uint16 port,uint32 scope_id);
int socket_listen(int s,unsigned int backlog);
int socket_accept4(int s,char* ip,uint16* port);
int socket_accept6(int s,char* ip,uint16* port,uint32* scope_id);
int socket_recv4(int s,char* buf,unsigned int len,char* ip,uint16* port);
int socket_recv6(int s,char* buf,unsigned int len,char* ip,uint16* port,uint32* scope_id);
int socket_send4(int s,const char* buf,unsigned int len,const char* ip,uint16 port);
int socket_send6(int s,const char* buf,unsigned int len,const char* ip,uint16 port,uint32 scope_id);
int socket_local4(int s,char* ip,uint16* port);
int socket_local6(int s,char* ip,uint16* port,uint32* scope_id);
int socket_remote4(int s,char* ip,uint16* port);
int socket_remote6(int s,char* ip,uint16* port,uint32* scope_id);
/* enable sending udp packets to the broadcast address */
extern int socket_broadcast(int s);
int socket_broadcast(int s);
/* join a multicast group on the given interface */
extern int socket_mcjoin4(int s,const char* groupip,const char* interface);
extern int socket_mcjoin6(int s,const char* groupip,int interface);
int socket_mcjoin4(int s,const char* groupip,const char* interface);
int socket_mcjoin6(int s,const char* groupip,int interface);
/* leave a multicast group on the given interface */
extern int socket_mcleave4(int s,const char* groupip);
extern int socket_mcleave6(int s,const char* groupip);
int socket_mcleave4(int s,const char* groupip);
int socket_mcleave6(int s,const char* groupip);
/* set multicast TTL/hop count for outgoing packets */
extern int socket_mcttl4(int s,char hops);
extern int socket_mchopcount6(int s,char hops);
int socket_mcttl4(int s,char hops);
int socket_mchopcount6(int s,char hops);
/* enable multicast loopback */
extern int socket_mcloop4(int s,char hops);
extern int socket_mcloop6(int s,char hops);
int socket_mcloop4(int s,char hops);
int socket_mcloop6(int s,char hops);
extern void socket_tryreservein(int s,int size);
void socket_tryreservein(int s,int size);
extern const char* socket_getifname(uint32 interface);
extern uint32 socket_getifidx(const char* ifname);
const char* socket_getifname(uint32 interface);
uint32 socket_getifidx(const char* ifname);
extern int socket_sendfile(int out,int in,uint32 offset,uint32 bytes);
int socket_sendfile(int out,int in,uint32 offset,uint32 bytes);
extern int noipv6;
int noipv6;
#endif

14
str.h

@ -10,14 +10,14 @@
/* str_copy copies leading bytes from in to out until \0.
* return number of copied bytes. */
extern unsigned long str_copy(char *out,const char *in);
unsigned long str_copy(char *out,const char *in);
/* str_diff returns negative, 0, or positive, depending on whether the
* string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than,
* equal to, or greater than the string b[0], b[1], ..., b[m-1]=='\0'.
* If the strings are different, str_diff does not read bytes past the
* first difference. */
extern int str_diff(const char *a,const char *b) __pure__;
int str_diff(const char *a,const char *b) __pure__;
/* str_diffn returns negative, 0, or positive, depending on whether the
* string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than,
@ -25,24 +25,24 @@ extern int str_diff(const char *a,const char *b) __pure__;
* If the strings are different, str_diffn does not read bytes past the
* first difference. The strings will be considered equal if the first
* limit characters match. */
extern int str_diffn(const char *a,const char *b,unsigned long limit) __pure__;
int str_diffn(const char *a,const char *b,unsigned long limit) __pure__;
#ifdef __dietlibc__
#include <string.h>
#define str_len(foo) strlen(foo)
#else
/* str_len returns the index of \0 in s */
extern unsigned long str_len(const char *s) __pure__;
unsigned long str_len(const char *s) __pure__;
#endif
/* str_chr returns the index of the first occurance of needle or \0 in haystack */
extern unsigned long str_chr(const char *haystack,char needle) __pure__;
unsigned long str_chr(const char *haystack,char needle) __pure__;
/* str_rchr returns the index of the last occurance of needle or \0 in haystack */
extern unsigned long str_rchr(const char *haystack,char needle) __pure__;
unsigned long str_rchr(const char *haystack,char needle) __pure__;
/* str_start returns 1 if the b is a prefix of a, 0 otherwise */
extern int str_start(const char *a,const char *b) __pure__;
int str_start(const char *a,const char *b) __pure__;
/* convenience shortcut to test for string equality */
#define str_equal(s,t) (!str_diff((s),(t)))

44
stralloc.h

@ -23,7 +23,7 @@ typedef struct stralloc {
/* stralloc_init will initialize a stralloc.
* Previously allocated memory will not be freed; use stralloc_free for
* that. To assign an empty string, use stralloc_copys(sa,""). */
extern void stralloc_init(stralloc* sa);
void stralloc_init(stralloc* sa);
/* stralloc_ready makes sure that sa has enough space allocated to hold
* len bytes: If sa is not allocated, stralloc_ready allocates at least
@ -32,58 +32,58 @@ extern void stralloc_init(stralloc* sa);
* bytes of space, copies the old string into the new space, frees the
* old space, and returns 1. Note that this changes sa.s. If the
* allocation fails, stralloc_ready leaves sa alone and returns 0. */
extern int stralloc_ready(stralloc* sa,unsigned int len);
int stralloc_ready(stralloc* sa,unsigned int len);
/* stralloc_readyplus is like stralloc_ready except that, if sa is
* already allocated, stralloc_readyplus adds the current length of sa
* to len. */
extern int stralloc_readyplus(stralloc* sa,unsigned int len);
int stralloc_readyplus(stralloc* sa,unsigned int len);
/* stralloc_copyb copies the string buf[0], buf[1], ..., buf[len-1] into
* sa, allocating space if necessary, and returns 1. If it runs out of
* memory, stralloc_copyb leaves sa alone and returns 0. */
extern int stralloc_copyb(stralloc* sa,const char* buf,unsigned int len);
int stralloc_copyb(stralloc* sa,const char* buf,unsigned int len);
/* stralloc_copys copies a \0-terminated string from buf into sa,
* without the \0. It is the same as
* stralloc_copyb(&sa,buf,str_len(buf)). */
extern int stralloc_copys(stralloc* sa,const char* buf);
int stralloc_copys(stralloc* sa,const char* buf);
/* stralloc_copy copies the string stored in sa2 into sa. It is the same
* as stralloc_copyb(&sa,sa2.s,sa2.len). sa2 must already be allocated. */
extern int stralloc_copy(stralloc* sa,const stralloc* sa2);
int stralloc_copy(stralloc* sa,const stralloc* sa2);
/* stralloc_catb adds the string buf[0], buf[1], ... buf[len-1] to the
* end of the string stored in sa, allocating space if necessary, and
* returns 1. If sa is unallocated, stralloc_catb is the same as
* stralloc_copyb. If it runs out of memory, stralloc_catb leaves sa
* alone and returns 0. */
extern int stralloc_catb(stralloc* sa,const char* in,unsigned int len);
int stralloc_catb(stralloc* sa,const char* in,unsigned int len);
/* stralloc_cats is analogous to stralloc_copys */
extern int stralloc_cats(stralloc* sa,const char* in);
int stralloc_cats(stralloc* sa,const char* in);
/* stralloc_cat is analogous to stralloc_copy */
extern int stralloc_cat(stralloc* sa,stralloc* in);
int stralloc_cat(stralloc* sa,stralloc* in);
/* stralloc_append adds one byte in[0] to the end of the string stored
* in sa. It is the same as stralloc_catb(&sa,in,1). */
extern int stralloc_append(stralloc* sa,const char* in); /* beware: this takes a pointer to 1 char */
int stralloc_append(stralloc* sa,const char* in); /* beware: this takes a pointer to 1 char */
/* stralloc_starts returns 1 if the \0-terminated string in "in", without
* the terminating \0, is a prefix of the string stored in sa. Otherwise
* it returns 0. sa must already be allocated. */
extern int stralloc_starts(stralloc* sa,const char* in) __pure__;
int stralloc_starts(stralloc* sa,const char* in) __pure__;
/* stralloc_diff returns negative, 0, or positive, depending on whether
* a is lexicographically smaller than, equal to, or greater than the
* string b. */
extern int stralloc_diff(const stralloc* a,const stralloc* b) __pure__;
int stralloc_diff(const stralloc* a,const stralloc* b) __pure__;
/* stralloc_diffs returns negative, 0, or positive, depending on whether
* a is lexicographically smaller than, equal to, or greater than the
* string b[0], b[1], ..., b[n]=='\0'. */
extern int stralloc_diffs(const stralloc* a,const char* b) __pure__;
int stralloc_diffs(const stralloc* a,const char* b) __pure__;
#define stralloc_equal(a,b) (!stralloc_diff((a),(b)))
#define stralloc_equals(a,b) (!stralloc_diffs((a),(b)))
@ -92,13 +92,13 @@ extern int stralloc_diffs(const stralloc* a,const char* b) __pure__;
#define stralloc_0(sa) stralloc_append(sa,"")
/* stralloc_catulong0 appends a '0' padded ASCII representation of in */
extern int stralloc_catulong0(stralloc* sa,unsigned long in,unsigned int n);
int stralloc_catulong0(stralloc* sa,unsigned long in,unsigned int n);
/* stralloc_catlong0 appends a '0' padded ASCII representation of in */
extern int stralloc_catlong0(stralloc* sa,signed long in,unsigned int n);
int stralloc_catlong0(stralloc* sa,signed long in,unsigned int n);
/* stralloc_free frees the storage associated with sa */
extern void stralloc_free(stralloc* sa);
void stralloc_free(stralloc* sa);
#define stralloc_catlong(sa,l) (stralloc_catlong0((sa),(l),0))
#define stralloc_catuint0(sa,i,n) (stralloc_catulong0((sa),(i),(n)))
@ -106,14 +106,14 @@ extern void stralloc_free(stralloc* sa);
#define stralloc_catint(sa,i) (stralloc_catlong0((sa),(i),0))
/* remove last char. Return removed byte as unsigned char (or -1 if stralloc was empty). */
extern int stralloc_chop(stralloc* sa);
int stralloc_chop(stralloc* sa);
/* remove trailing "\r\n", "\n" or "\r". Return number of removed chars (0,1 or 2) */
extern int stralloc_chomp(stralloc* sa);
int stralloc_chomp(stralloc* sa);
#ifdef BUFFER_H
/* write stralloc to buffer */
extern int buffer_putsa(buffer* b,stralloc* sa);
int buffer_putsa(buffer* b,stralloc* sa);
/* these "read token" functions return 0 if the token was complete or
* EOF was hit or -1 on error. In contrast to the non-stralloc token
* functions, the separator is also put in the stralloc; use
@ -126,14 +126,14 @@ extern int buffer_putsa(buffer* b,stralloc* sa);
* data is available. */
/* read token from buffer to stralloc */
extern int buffer_get_token_sa(buffer* b,stralloc* sa,const char* charset,unsigned int setlen);
int buffer_get_token_sa(buffer* b,stralloc* sa,const char* charset,unsigned int setlen);
/* read line from buffer to stralloc */
extern int buffer_getline_sa(buffer* b,stralloc* sa);
int buffer_getline_sa(buffer* b,stralloc* sa);
typedef int (*sa_predicate)(stralloc* sa);
/* like buffer_get_token_sa but the token ends when your predicate says so */
extern int buffer_get_token_sa_pred(buffer* b,stralloc* sa,sa_predicate p);
int buffer_get_token_sa_pred(buffer* b,stralloc* sa,sa_predicate p);
#endif
#endif

12
tai.h

@ -32,7 +32,7 @@ typedef struct tai {
* the time function represents the number of TAI seconds since
* 1970-01-01 00:00:10 TAI. This matches the convention used by the
* Olson tz library in ``right'' mode. */
extern void tai_now(struct tai *);
void tai_now(struct tai *);
/* tai_approx returns a double-precision approximation to t. The result
* of tai_approx is always nonnegative. */
@ -40,21 +40,21 @@ extern void tai_now(struct tai *);
/* tai_add adds a to b modulo 2^64 and puts the result into t. The
* inputs and output may overlap. */
extern void tai_add(struct tai *,const struct tai *,const struct tai *);
void tai_add(struct tai *,const struct tai *,const struct tai *);
/* tai_sub subtracts b from a modulo 2^64 and puts the result into t.
* The inputs and output may overlap. */
extern void tai_sub(struct tai *,const struct tai *,const struct tai *);
void tai_sub(struct tai *,const struct tai *,const struct tai *);
/* tai_less returns 1 if a is less than b, 0 otherwise. */
#define tai_less(t,u) ((t)->x < (u)->x)
#define TAI_PACK 8
/* tai_pack converts a TAI64 label from internal format in t to external
* TAI64 format in buf. */
extern void tai_pack(char *,const struct tai *);
void tai_pack(char *,const struct tai *);
/* tai_unpack converts a TAI64 label from external TAI64 format in buf
* to internal format in t. */
extern void tai_unpack(const char *,struct tai *);
void tai_unpack(const char *,struct tai *);
extern void tai_uint(struct tai *,unsigned int);
void tai_uint(struct tai *,unsigned int);
#endif

18
uint16.h

@ -8,17 +8,17 @@ typedef signed short int16;
#define uint16_pack(out,in) (*(uint16*)(out)=(in))
#define uint16_unpack(in,out) (*(out)=*(uint16*)(in))
#define uint16_read(in) (*(uint16*)(in))
extern void uint16_pack_big(char *out,uint16 in);
extern void uint16_unpack_big(const char *in,uint16* out);
extern uint16 uint16_read_big(const char *in);
void uint16_pack_big(char *out,uint16 in);
void uint16_unpack_big(const char *in,uint16* out);
uint16 uint16_read_big(const char *in);
#else
extern void uint16_pack(char *out,uint16 in);
extern void uint16_pack_big(char *out,uint16 in);
extern void uint16_unpack(const char *in,uint16* out);
extern void uint16_unpack_big(const char *in,uint16* out);
extern uint16 uint16_read(const char *in);
extern uint16 uint16_read_big(const char *in);
void uint16_pack(char *out,uint16 in);
void uint16_pack_big(char *out,uint16 in);
void uint16_unpack(const char *in,uint16* out);
void uint16_unpack_big(const char *in,uint16* out);
uint16 uint16_read(const char *in);
uint16 uint16_read_big(const char *in);
#endif

18
uint32.h

@ -8,17 +8,17 @@ typedef signed int int32;
#define uint32_pack(out,in) (*(uint32*)(out)=(in))
#define uint32_unpack(in,out) (*(out)=*(uint32*)(in))
#define uint32_read(in) (*(uint32*)(in))
extern void uint32_pack_big(char *out,uint32 in);
extern void uint32_unpack_big(const char *in,uint32* out);
extern uint32 uint32_read_big(const char *in);
void uint32_pack_big(char *out,uint32 in);
void uint32_unpack_big(const char *in,uint32* out);
uint32 uint32_read_big(const char *in);
#else
extern void uint32_pack(char *out,uint32 in);
extern void uint32_pack_big(char *out,uint32 in);
extern void uint32_unpack(const char *in,uint32* out);
extern void uint32_unpack_big(const char *in,uint32* out);
extern uint32 uint32_read(const char *in);
extern uint32 uint32_read_big(const char *in);
void uint32_pack(char *out,uint32 in);
void uint32_pack_big(char *out,uint32 in);
void uint32_unpack(const char *in,uint32* out);
void uint32_unpack_big(const char *in,uint32* out);
uint32 uint32_read(const char *in);
uint32 uint32_read_big(const char *in);
#endif

Loading…
Cancel
Save