diff options
author | Jan Kneschke <jan@kneschke.de> | 2005-02-28 10:38:16 +0000 |
---|---|---|
committer | Jan Kneschke <jan@kneschke.de> | 2005-02-28 10:38:16 +0000 |
commit | 75fae49e37c61411edb5805322d56ce97bbe0587 (patch) | |
tree | 4064734717e30adb264a420e392e45ca5ebe8a85 /src/buffer.h | |
parent | d9fd24a0f7ded6e6e55bd3050d997b3133d1a9f4 (diff) | |
download | lighttpd-git-75fae49e37c61411edb5805322d56ce97bbe0587.tar.gz |
* If sizeof(long) == sizeof(off_t), buffer_{append,copy}_off_t()
are only macros to buffer_{append,copy}_long()
* ltostr() returns the string length instead of always 0
* Don't check return value of buffer_prepare_append(buffer *b), since
it only returns -1 if b == NULL, which we do a few lines above anyway.
* Improved buffer_path_simplify(). No "dot_stack" required anymore.
Operation can also be performed inplace.
* Check errno also against EACCES at pidfile-unlink for not logging
a "Permission denied".
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@54 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/buffer.h b/src/buffer.h index 53febed6..585b6c80 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -33,17 +33,6 @@ typedef struct { size_t size; } read_buffer; -typedef struct { - const char *start; - size_t len; -} dot; - -typedef struct { - dot **ptr; - size_t used; - size_t size; -} dot_stack; - buffer_array* buffer_array_init(void); void buffer_array_free(buffer_array *b); buffer *buffer_array_append_get_buffer(buffer_array *b); @@ -61,8 +50,7 @@ int buffer_copy_string_len(buffer *b, const char *s, size_t s_len); int buffer_copy_string_buffer(buffer *b, const buffer *src); int buffer_copy_string_hex(buffer *b, const char *in, size_t in_len); -int buffer_copy_long(buffer *b, long l); -int buffer_copy_off_t(buffer *b, off_t l); +int buffer_copy_long(buffer *b, long val); int buffer_copy_memory(buffer *b, const char *s, size_t s_len); @@ -73,8 +61,15 @@ int buffer_append_string_lfill(buffer *b, const char *s, size_t maxlen); int buffer_append_string_rfill(buffer *b, const char *s, size_t maxlen); int buffer_append_hex(buffer *b, unsigned long len); -int buffer_append_long(buffer *b, long l); -int buffer_append_off_t(buffer *b, off_t l); +int buffer_append_long(buffer *b, long val); + +#if defined(SIZEOF_LONG) && (SIZEOF_LONG == SIZEOF_OFF_T) +#define buffer_copy_off_t(x, y) buffer_copy_long(x, y) +#define buffer_append_off_t(x, y) buffer_append_long(x, y) +#else +int buffer_copy_off_t(buffer *b, off_t val); +int buffer_append_off_t(buffer *b, off_t val); +#endif int buffer_append_memory(buffer *b, const char *s, size_t s_len); @@ -91,10 +86,10 @@ int buffer_append_string_url_encoded(buffer *b, const char *s); int buffer_append_string_html_encoded(buffer *b, const char *s); int buffer_urldecode(buffer *url); -int buffer_path_simplify(dot_stack *stack, buffer *out, buffer *in); +int buffer_path_simplify(buffer *dest, buffer *src); /** deprecated */ -int ltostr(char *s, long l); +int ltostr(char *buf, long val); char hex2int(unsigned char c); char int2hex(char i); |