Amanda-Users

Re: 2.5.2 compilation failure on irix-6.5.x

2007-05-07 14:54:58
Subject: Re: 2.5.2 compilation failure on irix-6.5.x
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Pieter Bowman <bowman AT math.utah DOT edu>
Date: Mon, 07 May 2007 14:29:51 -0400
Pieter, Jean-Francois,

Can you try the attached patch for the vstrallocf problem.

Jean-Louis

Pieter Bowman wrote:
...
First go at amanda-2.5.2 on a system running irix-6.5.x
and compile fails with the error:
...

This is the case on both IRIX and OSF/1.  These compilers can't
handle:

#define vstrallocf(...)         debug_vstrallocf(__FILE__,__LINE__,__VA_ARGS__)

The patch for sockaddr_storage seems to work with the addition of
these two definitions in amanda.h:


/* Needed on SGI IRIX 6.5 */
#ifdef WORKING_IPV6
#define INET6
#endif

#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif

Pieter

diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/common-src/alloc.c 
amanda-2.5.2.vstralloc/common-src/alloc.c
--- amanda-2.5.2/common-src/alloc.c     2007-05-04 07:39:08.000000000 -0400
+++ amanda-2.5.2.vstrallocf/common-src/alloc.c  2007-05-07 14:27:57.000000000 
-0400
@@ -389,8 +389,6 @@ arglist_function1(
  */
 char *
 debug_vstrallocf(
-    const char *file,
-    int         line,
     const char *fmt,
     ...)
 {
@@ -398,9 +396,10 @@ debug_vstrallocf(
     size_t      size;
     va_list     argp;
 
-    malloc_enter(debug_caller_loc(file, line));
+    debug_alloc_pop();
+    malloc_enter(debug_caller_loc(saved_file, saved_line));
 
-    result = debug_alloc(file, line, MIN_ALLOC);
+    result = debug_alloc(saved_file, saved_line, MIN_ALLOC);
     if (result != NULL) {
 
        arglist_start(argp, fmt);
@@ -409,7 +408,7 @@ debug_vstrallocf(
 
        if (size >= (size_t)MIN_ALLOC) {
            amfree(result);
-           result = debug_alloc(file, line, size + 1);
+           result = debug_alloc(saved_file, saved_line, size + 1);
 
            arglist_start(argp, fmt);
            (void)vsnprintf(result, size + 1, fmt, argp);
@@ -417,7 +416,7 @@ debug_vstrallocf(
        }
     }
 
-    malloc_leave(debug_caller_loc(file, line));
+    malloc_leave(debug_caller_loc(saved_file, saved_line));
     return result;
 }
 
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/common-src/amanda.h 
amanda-2.5.2.vstralloc/common-src/amanda.h
--- amanda-2.5.2/common-src/amanda.h    2007-05-04 07:39:08.000000000 -0400
+++ amanda-2.5.2.vstrallocf/common-src/amanda.h 2007-05-07 14:22:45.000000000 
-0400
@@ -577,8 +577,6 @@ extern void *debug_newalloc   (const cha
 extern char *debug_stralloc   (const char *c, int l, const char *str);
 extern char *debug_newstralloc(const char *c, int l, char *oldstr,
                               const char *newstr);
-extern char *debug_vstrallocf(const char *file, int line, const char *fmt,
-                             ...) __attribute__ ((format (printf, 3, 4)));
 extern const char *debug_caller_loc (const char *file, int line);
 extern int debug_alloc_push (char *file, int line);
 extern void debug_alloc_pop (void);
@@ -620,10 +618,12 @@ extern void debug_alloc_pop (void);
 
 #define vstralloc debug_alloc_push(__FILE__,__LINE__)?0:debug_vstralloc
 #define newvstralloc debug_alloc_push(__FILE__,__LINE__)?0:debug_newvstralloc
-#define vstrallocf(...)         debug_vstrallocf(__FILE__,__LINE__,__VA_ARGS__)
+#define vstrallocf debug_alloc_push(__FILE__,__LINE__)?0:debug_vstrallocf
 
 extern char  *debug_vstralloc(const char *str, ...);
 extern char  *debug_newvstralloc(char *oldstr, const char *newstr, ...);
+extern char  *debug_vstrallocf(const char *fmt, ...)
+                              __attribute__ ((format (printf, 1, 2)));
 
 #define        stralloc2(s1,s2)      vstralloc((s1),(s2),NULL)
 #define        newstralloc2(p,s1,s2) newvstralloc((p),(s1),(s2),NULL)
<Prev in Thread] Current Thread [Next in Thread>