kannel 1.4.0 portability fixes

Mike Bristow <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

I've been trying to compile kannel 1.4.0 with a non-gcc compiler, and
have a small pile of patches required to do so.

Anyway, here are the first two issues; is this the best place to
report them?


In radius/radius_pdu.c:

--- radius/radius_pdu.c 22 Jan 2004 14:08:25 -0000      1.1.1.1
+++ radius/radius_pdu.c 15 Feb 2005 15:02:32 -0000      1.1.1.1.2.1
@@ -296,7 +296,7 @@
                 int c = octstr_get_char(value, i);
                 Octstr *b = octstr_format("%d", c);
                 octstr_append(ret, b);
-                i < 3 ? octstr_append_cstr(ret, ".") : NULL;
+                if (i < 3) octstr_append_cstr(ret, ".");
                 octstr_destroy(b);
             }
             break;


This is a syntax error that GCC will complain about with "-pedantic
-Wall", but the fix (as you can see) is simple enough.   (It's a
syntax error because octstr_append_cstr has type "void", and NULL
isn't a void, but a deeply magic thing, so the two halfs of the ?:
have incompatible types).


Secondly, in gw/smsc/smsc_smpp.c:

--- gw/smsc/smsc_smpp.c 21 Oct 2004 12:33:40 -0000      1.1.1.2
+++ gw/smsc/smsc_smpp.c 16 Feb 2005 11:04:07 -0000      1.1.1.2.2.2
@@ -1548,7 +1548,7 @@
                     }
                 }
                 debug("bb.sms.smpp", 0, "SMPP[%s]: %s: break and shutting down",
-                      octstr_get_cstr(smpp->conn->id), __PRETTY_FUNCTION__);
+                      octstr_get_cstr(smpp->conn->id), __func__);

                 break;
             }

__PRETTY_FUNCTION__ is a GCCism.  gw-config.h already has a construct to 
define a replacement for the C99 __func__ macro if one is required, so 
using that seems sensible (and increases portability to older versions
of gcc for free).



-- 
Mike Bristow - really a very good driver
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.