aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1999-01-29 17:06:56 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1999-01-29 17:06:56 +0000
commit7cae0c6bd339c59b607568368e3fdfdda305d38d (patch)
treef3c0566eeff4bc9aff58cf630b74dfaf16b8921c /wiretap
parent69458d2e922042d2a08934af21d7e45dbb6eec14 (diff)
Modified code to allow compilation under IBM's C compiler for AIX.
svn path=/trunk/; revision=178
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/buffer.c18
-rw-r--r--wiretap/debug.h57
-rw-r--r--wiretap/lanalyzer.c4
3 files changed, 5 insertions, 74 deletions
diff --git a/wiretap/buffer.c b/wiretap/buffer.c
index 655c39bd86..ecfd63d3df 100644
--- a/wiretap/buffer.c
+++ b/wiretap/buffer.c
@@ -1,6 +1,6 @@
/* buffer.c
*
- * $Id: buffer.c,v 1.3 1998/11/12 23:29:33 gram Exp $
+ * $Id: buffer.c,v 1.4 1999/01/29 17:06:56 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -29,14 +29,9 @@
#include "buffer.h"
#include "glib.h"
-/*#define DEBUG*/
-#define DEBUG_PROGRAM_NAME "buffer.c"
-#include "debug.h"
-
/* Initializes a buffer with a certain amount of allocated space */
void buffer_init(Buffer* buffer, unsigned int space)
{
- debug("buffer_init\n");
buffer->data = (char*)g_malloc(space);
buffer->allocated = space;
buffer->start = 0;
@@ -46,7 +41,6 @@ void buffer_init(Buffer* buffer, unsigned int space)
/* Frees the memory used by a buffer, and the buffer struct */
void buffer_free(Buffer* buffer)
{
- debug("buffer_free\n");
free(buffer->data);
}
@@ -60,7 +54,6 @@ void buffer_assure_space(Buffer* buffer, unsigned int space)
unsigned int space_used;
int space_at_beginning;
- debug("buffer_assure_space %d bytes\n", space);
/* If we've got the space already, good! */
if (space <= available_at_end) {
return;
@@ -94,7 +87,6 @@ void buffer_assure_space(Buffer* buffer, unsigned int space)
void buffer_append(Buffer* buffer, char *from, unsigned int bytes)
{
- debug("buffer_append %d bytes\n", bytes);
buffer_assure_space(buffer, bytes);
memcpy(buffer->data + buffer->first_free, from, bytes);
buffer->first_free += bytes;
@@ -102,10 +94,10 @@ void buffer_append(Buffer* buffer, char *from, unsigned int bytes)
void buffer_remove_start(Buffer* buffer, unsigned int bytes)
{
- debug("buffer_remove_start %d bytes\n", bytes);
if (buffer->start + bytes > buffer->first_free) {
- die("buffer_remove_start trying to remove %d bytes. s=%d ff=%d!\n",
+ g_error("buffer_remove_start trying to remove %d bytes. s=%d ff=%d!\n",
bytes, buffer->start, buffer->first_free);
+ exit(1);
}
buffer->start += bytes;
@@ -119,7 +111,6 @@ void buffer_remove_start(Buffer* buffer, unsigned int bytes)
#ifndef SOME_FUNCTIONS_ARE_DEFINES
void buffer_increase_length(Buffer* buffer, unsigned int bytes)
{
- debug("buffer_increase_length %d bytes\n", bytes);
buffer->first_free += bytes;
}
#endif
@@ -127,7 +118,6 @@ void buffer_increase_length(Buffer* buffer, unsigned int bytes)
#ifndef SOME_FUNCTIONS_ARE_DEFINES
unsigned int buffer_length(Buffer* buffer)
{
- debug("buffer_length\n");
return buffer->first_free - buffer->start;
}
#endif
@@ -135,7 +125,6 @@ unsigned int buffer_length(Buffer* buffer)
#ifndef SOME_FUNCTIONS_ARE_DEFINES
char* buffer_start_ptr(Buffer* buffer)
{
- debug("buffer_start_ptr\n");
return buffer->data + buffer->start;
}
#endif
@@ -143,7 +132,6 @@ char* buffer_start_ptr(Buffer* buffer)
#ifndef SOME_FUNCTIONS_ARE_DEFINES
char* buffer_end_ptr(Buffer* buffer)
{
- debug("buffer_end_ptr\n");
return buffer->data + buffer->first_free;
}
#endif
diff --git a/wiretap/debug.h b/wiretap/debug.h
deleted file mode 100644
index 0c9c84489e..0000000000
--- a/wiretap/debug.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* debug.h
- -------
- Macros for doing debug work.
-
- Define DEBUG_PROGRAM_NAME to the name of your program. It will print out in
- all debug messages, to separate your program's debug messages from
- other programs' messages.
-
- Define DEBUG to invoke the debug macros. Undefine (or don't define)
- DEBUG to not have debug messages.
-
- In either case, you now have three printf()-like functions:
-
- debug() for debug-only messages
- warn() to print to stderr
- die() to print to stderr and exit with failure
-
- Copyright (C) 1997 Gilbert Ramirez <gram@merece.uthscsa.edu>
- $Id: debug.h,v 1.1 1998/11/12 00:06:45 gram Exp $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-
-#ifdef DEBUG
- #define debug(format, args...) fprintf(stdout, format, ## args)
- #define warn(format, args...) { \
- fprintf(stdout, DEBUG_PROGRAM_NAME ": " format, ## args); \
- fprintf(stderr, DEBUG_PROGRAM_NAME ": " format, ## args); \
- }
- #define die(format, args...) { \
- fprintf(stdout, DEBUG_PROGRAM_NAME ": " format, ## args); \
- fprintf(stderr, DEBUG_PROGRAM_NAME ": " format, ## args); \
- exit(-1); \
- }
-#else /* not DEBUG */
- #define debug(format, args...)
- #define warn(format, args...) \
- fprintf(stderr, DEBUG_PROGRAM_NAME ": " format, ## args)
- #define die(format, args...) { \
- fprintf(stderr, DEBUG_PROGRAM_NAME ": " format, ## args); \
- exit(-1); \
- }
-#endif /* DEBUG */
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
index bb59762626..f8e2dd556d 100644
--- a/wiretap/lanalyzer.c
+++ b/wiretap/lanalyzer.c
@@ -1,6 +1,6 @@
/* lanalyzer.c
*
- * $Id: lanalyzer.c,v 1.7 1999/01/07 16:15:35 gram Exp $
+ * $Id: lanalyzer.c,v 1.8 1999/01/29 17:06:56 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -126,7 +126,7 @@ int lanalyzer_open(wtap *wth)
wth->capture.lanalyzer->pkt_len = length - 32;
return WTAP_FILE_LANALYZER;
- default:
+ /* default: no default action */
/* printf("Record 0x%04X Length %d\n", type, length);*/
}
}