changeset 430:b296fd9d8752

- Allowed compilation with older machines by removing a few C99isms. - Added use of inttypes.h when stdint.h isn't found.
author jcid
date Wed, 22 Oct 2008 19:44:40 +0200
parents 6d09e72a4dd0
children a7bee8ac9309
files ChangeLog configure.in dlib/dlib.c src/cache.c src/decode.c src/dns.c
diffstat 6 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 21 22:37:15 2008 +0200
+++ b/ChangeLog	Wed Oct 22 19:44:40 2008 +0200
@@ -13,6 +13,9 @@
    Patches: place (AKA corvid)
 +- Switched SSL enabled to configure.in (./configure --enable-ssl).
    Patch: Jeremy Henty
++- Allowed compilation with older machines by removing a few C99isms.
+ - Added use of inttypes.h when stdint.h isn't found.
+   Patches: Dan Fandrich
 
 dw
 
--- a/configure.in	Tue Oct 21 22:37:15 2008 +0200
+++ b/configure.in	Wed Oct 22 19:44:40 2008 +0200
@@ -70,6 +70,8 @@
 
 #if HAVE_STDINT_H == 0
 #include <stdint.h>
+#elif defined(HAVE_INTTYPES_H)
+#include <inttypes.h>
 #else
 typedef signed $gint16    int16_t;
 typedef unsigned $gint16  uint16_t;
--- a/dlib/dlib.c	Tue Oct 21 22:37:15 2008 +0200
+++ b/dlib/dlib.c	Wed Oct 22 19:44:40 2008 +0200
@@ -204,10 +204,11 @@
  */
 Dstr *dStr_sized_new (int sz)
 {
+   Dstr *ds;
    if (sz < 2)
       sz = 2;
 
-   Dstr *ds = dNew(Dstr, 1);
+   ds = dNew(Dstr, 1);
    ds->str = NULL;
    dStr_resize(ds, sz + 1, 0); /* (sz + 1) for the extra '\0' */
    return ds;
@@ -476,10 +477,11 @@
  */
 Dlist *dList_new(int size)
 {
+   Dlist *l;
    if (size <= 0)
       return NULL;
 
-   Dlist *l = dNew(Dlist, 1);
+   l = dNew(Dlist, 1);
    l->len = 0;
    l->sz = size;
    l->list = dNew(void*, l->sz);
--- a/src/cache.c	Tue Oct 21 22:37:15 2008 +0200
+++ b/src/cache.c	Wed Oct 22 19:44:40 2008 +0200
@@ -513,8 +513,9 @@
 {
    CacheEntry_t *entry = Cache_entry_search_with_redirect(Url);
    if (entry) {
+      Dstr *data;
       Cache_ref_data(entry);
-      Dstr *data = Cache_data(entry);
+      data = Cache_data(entry);
       *PBuf = data->str;
       *BufSize = data->len;
    } else {
--- a/src/decode.c	Tue Oct 21 22:37:15 2008 +0200
+++ b/src/decode.c	Wed Oct 22 19:44:40 2008 +0200
@@ -221,9 +221,9 @@
 
    if (format && *format) {
       if (!dStrcasecmp(format, "gzip") || !dStrcasecmp(format, "x-gzip")) {
+         z_stream *zs;
          _MSG("gzipped data!\n");
 
-         z_stream *zs;
          dc = dNew(Decode, 1);
          dc->buffer = dNew(char, bufsize);
          dc->state = zs = dNew(z_stream, 1);
--- a/src/dns.c	Tue Oct 21 22:37:15 2008 +0200
+++ b/src/dns.c	Wed Oct 22 19:44:40 2008 +0200
@@ -267,12 +267,13 @@
    int channel = VOIDP2INT(data);
    struct addrinfo hints, *res0;
    int error;
+   Dlist *hosts;
 
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
 
-   Dlist *hosts = dList_new(2);
+   hosts = dList_new(2);
 
    _MSG("Dns_server: starting...\n ch: %d host: %s\n",
         channel, dns_server[channel].hostname);