1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
--- src/msql/libmsql.c.bak Wed Aug 22 04:17:08 2001
+++ src/msql/libmsql.c Thu Sep 11 11:02:19 2003
@@ -88,11 +88,11 @@
RETSIGTYPE pipeHandler(int);
#endif
-#if defined(_OS_OS2) || defined (_OS_WIN32)
-static void msqlDebug( int module, ... );
+#if defined(_OS_OS2) || defined (_OS_WIN32) || defined(ANSI_ARGS)
+static void msqlDebug( int module, char *fmt, ... );
#endif
-#if defined(_OS_UNIX)
+#if defined(_OS_UNIX) && !defined(ANSI_ARGS)
static void msqlDebug();
#endif
@@ -216,23 +216,24 @@
*/
#ifdef ANSI_ARGS
-static void msqlDebug(int module, ...)
+static void msqlDebug(int module, char *fmt, ...)
#else
static void msqlDebug(va_alist)
va_dcl
#endif
{
va_list args;
- char msg[1024],
- *fmt;
+ char msg[1024];
#ifdef ANSI_ARGS
- va_start(args, module);
+ va_start(args, fmt);
#else
int module;
+ char *fmt;
va_start(args);
module = (int) va_arg(args, int );
+ fmt = (char *)va_arg(args, char *);
#endif
if (! (module & debugLevel))
@@ -241,9 +242,10 @@
return;
}
- fmt = (char *)va_arg(args, char *);
- if (!fmt)
+ if (!fmt) {
+ va_end(args);
return;
+ }
(void)vsprintf(msg,fmt,args);
va_end(args);
fprintf(stderr,"[libmsql] %s",msg);
|