From 7642653a18f7464dd093a93a1247b8f18e53cd1a Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 18 Nov 2010 13:40:50 +0000 Subject: [PATCH] Make tmpalloc global variables static Functions don't need to be declared extern Report how many bytes were left if a decode error occurs Remove an obsoleve method from gldbg.h --- source/gldbg.h | 1 - source/gldump.c | 2 +- source/tmpalloc.c | 6 +++--- source/tmpalloc.h | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/gldbg.h b/source/gldbg.h index d8b56f8..e539982 100644 --- a/source/gldbg.h +++ b/source/gldbg.h @@ -44,7 +44,6 @@ private: void tick(); void check_child(); void read_stream(); - long ptrace(int, void *, void *); virtual void sighandler(int); }; diff --git a/source/gldump.c b/source/gldump.c index 79896c2..c7dbf5e 100644 --- a/source/gldump.c +++ b/source/gldump.c @@ -47,7 +47,7 @@ int main(int argc, char **argv) ret = gldecoder_decode(dec, ptr, end-ptr); if(ret<0) { - fprintf(stderr, "Decode error\n"); + fprintf(stderr, "Decode error with %d bytes left\n", end-ptr); break; } ptr += ret; diff --git a/source/tmpalloc.c b/source/tmpalloc.c index 56d955e..26b6d08 100644 --- a/source/tmpalloc.c +++ b/source/tmpalloc.c @@ -8,9 +8,9 @@ Distributed under the GPL #include #include "tmpalloc.h" -void *buffer = 0; -unsigned buf_size = 8192; -unsigned offset = 0; +static void *buffer = 0; +static unsigned buf_size = 8192; +static unsigned offset = 0; void *tmpalloc(unsigned size) { diff --git a/source/tmpalloc.h b/source/tmpalloc.h index dc673ca..0ca29a5 100644 --- a/source/tmpalloc.h +++ b/source/tmpalloc.h @@ -12,12 +12,12 @@ Distributed under the GPL Allocates a temporary memory region. The returned memory comes from a shared pool and will get reused eventually. */ -extern void *tmpalloc(unsigned); +void *tmpalloc(unsigned); /** Frees the shared pool used by tmpalloc. It will be recreated if tmpalloc is called again. */ -extern void tmpfree(); +void tmpfree(); #endif -- 2.45.2