diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-07-29 06:09:59 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-07-29 06:09:59 +0000 |
commit | 6e21561be8a3f9a29a438ea945b7be7b933fc159 (patch) | |
tree | 8e70c43d1f42de696be79b546042e67623be1c06 /wiretap/buffer.c | |
parent | 4298a1f07da62f4791fcb5664fa5ba43b29944a3 (diff) |
From Joerg Mayer:
All files:
- Replace types from sys/types.h by those from glib.h
- Replace ntoh family of macros from netinet/in.h and winsock2.h
by g_ntoh family from glib.h
- Remove now unneeded includes of sys/types.h, netinet/in.h and
winsock2.h
wtap.h
Move includes to the top
svn path=/trunk/; revision=5909
Diffstat (limited to 'wiretap/buffer.c')
-rw-r--r-- | wiretap/buffer.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/wiretap/buffer.c b/wiretap/buffer.c index 9a69002f44..aae0e8fffa 100644 --- a/wiretap/buffer.c +++ b/wiretap/buffer.c @@ -1,6 +1,6 @@ /* buffer.c * - * $Id: buffer.c,v 1.12 2001/11/13 23:55:43 gram Exp $ + * $Id: buffer.c,v 1.13 2002/07/29 06:09:58 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -29,16 +29,12 @@ #include <string.h> #include <glib.h> -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - #include "buffer.h" /* Initializes a buffer with a certain amount of allocated space */ void buffer_init(Buffer* buffer, unsigned int space) { - buffer->data = (u_char*)g_malloc(space); + buffer->data = (guchar*)g_malloc(space); buffer->allocated = space; buffer->start = 0; buffer->first_free = 0; @@ -88,10 +84,10 @@ void buffer_assure_space(Buffer* buffer, unsigned int space) /* We'll allocate more space */ buffer->allocated += space + 1024; - buffer->data = (u_char*)g_realloc(buffer->data, buffer->allocated); + buffer->data = (guchar*)g_realloc(buffer->data, buffer->allocated); } -void buffer_append(Buffer* buffer, u_char *from, unsigned int bytes) +void buffer_append(Buffer* buffer, guchar *from, unsigned int bytes) { buffer_assure_space(buffer, bytes); memcpy(buffer->data + buffer->first_free, from, bytes); @@ -129,14 +125,14 @@ unsigned int buffer_length(Buffer* buffer) #endif #ifndef SOME_FUNCTIONS_ARE_DEFINES -u_char* buffer_start_ptr(Buffer* buffer) +guchar* buffer_start_ptr(Buffer* buffer) { return buffer->data + buffer->start; } #endif #ifndef SOME_FUNCTIONS_ARE_DEFINES -u_char* buffer_end_ptr(Buffer* buffer) +guchar* buffer_end_ptr(Buffer* buffer) { return buffer->data + buffer->first_free; } |