2006-10-09 [colin] 2.5.3cvs26
authorColin Leroy <colin@colino.net>
Mon, 9 Oct 2006 06:22:58 +0000 (06:22 +0000)
committerColin Leroy <colin@colino.net>
Mon, 9 Oct 2006 06:22:58 +0000 (06:22 +0000)
* configure.ac
* src/msgcache.c
* src/prefs_gtk.c
Check for existence of fgets_unlocked
and fwrite_unlocked

ChangeLog
PATCHSETS
configure.ac
src/msgcache.c
src/prefs_gtk.c

index 6a082e16c088e4eecdbf0ca7bc3363e40f0652a6..e4d7723101c65042e538a849e141b17599c6b7e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-10-09 [colin]     2.5.3cvs26
+
+       * configure.ac
+       * src/msgcache.c
+       * src/prefs_gtk.c
+               Check for existence of fgets_unlocked
+               and fwrite_unlocked
+
 2006-10-09 [paul]      2.5.3cvs25
 
        * src/prefs_summaries.c
 2006-10-09 [paul]      2.5.3cvs25
 
        * src/prefs_summaries.c
index dfbbc35766ddf658e6c34f22d4ca4920a5b6253e..05ae4c623310f4183a3fc2f90807e905884fc3c0 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.52.2.27 -r 1.52.2.28 src/prefs_folder_item.c;  ) > 2.5.3cvs23.patchset
 ( cvs diff -u -r 1.2.2.21 -r 1.2.2.22 po/sk.po;  ) > 2.5.3cvs24.patchset
 ( cvs diff -u -r 1.1.2.26 -r 1.1.2.27 src/prefs_summaries.c;  ) > 2.5.3cvs25.patchset
 ( cvs diff -u -r 1.52.2.27 -r 1.52.2.28 src/prefs_folder_item.c;  ) > 2.5.3cvs23.patchset
 ( cvs diff -u -r 1.2.2.21 -r 1.2.2.22 po/sk.po;  ) > 2.5.3cvs24.patchset
 ( cvs diff -u -r 1.1.2.26 -r 1.1.2.27 src/prefs_summaries.c;  ) > 2.5.3cvs25.patchset
+( cvs diff -u -r 1.654.2.2031 -r 1.654.2.2032 configure.ac;  cvs diff -u -r 1.16.2.45 -r 1.16.2.46 src/msgcache.c;  cvs diff -u -r 1.10.2.23 -r 1.10.2.24 src/prefs_gtk.c;  ) > 2.5.3cvs26.patchset
index 9c84ee96a6efef8231c68a4b10231042bf59747a..700835b46cec047f65cc76bea81393ce8677a100 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=5
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=25
+EXTRA_VERSION=26
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
@@ -302,6 +302,8 @@ AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
               uname flock lockf inet_aton inet_addr \
               fchmod mkstemp truncate getuid regcomp)
 
               uname flock lockf inet_aton inet_addr \
               fchmod mkstemp truncate getuid regcomp)
 
+AC_CHECK_FUNCS(fgets_unlocked fwrite_unlocked)
+
 dnl *****************
 dnl ** common code **
 dnl *****************
 dnl *****************
 dnl ** common code **
 dnl *****************
index 49b5eb1dde088788a32ddb13b6bdc3817d0d7321..8096d552268dc8fd0fef408693b89b9a4709952c 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "defs.h"
 
 #include "defs.h"
 
+#define _GNU_SOURCE
+#include <stdio.h>
+
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <sys/mman.h>
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <sys/mman.h>
 #include "codeconv.h"
 #include "timing.h"
 
 #include "codeconv.h"
 #include "timing.h"
 
+#ifdef HAVE_FWRITE_UNLOCKED
+#define SC_FWRITE fwrite_unlocked
+#else
+#define SC_FWRITE fwrite
+#endif
+
 #if G_BYTE_ORDER == G_BIG_ENDIAN
 #define bswap_32(x) \
      ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) | \
 #if G_BYTE_ORDER == G_BIG_ENDIAN
 #define bswap_32(x) \
      ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) | \
@@ -320,7 +333,7 @@ gint msgcache_get_memory_usage(MsgCache *cache)
        guint32 idata;                                  \
                                                        \
        idata = (guint32)bswap_32(n);                   \
        guint32 idata;                                  \
                                                        \
        idata = (guint32)bswap_32(n);                   \
-       if (fwrite_unlocked(&idata, sizeof(idata), 1, fp) != 1) \
+       if (SC_FWRITE(&idata, sizeof(idata), 1, fp) != 1)       \
                w_err = 1;                              \
        wrote += 4;                                     \
 }
                w_err = 1;                              \
        wrote += 4;                                     \
 }
@@ -344,7 +357,7 @@ gint msgcache_get_memory_usage(MsgCache *cache)
                len = strlen(data);                     \
        WRITE_CACHE_DATA_INT(len, fp);                  \
        if (w_err == 0 && len > 0) {                    \
                len = strlen(data);                     \
        WRITE_CACHE_DATA_INT(len, fp);                  \
        if (w_err == 0 && len > 0) {                    \
-               if (fwrite_unlocked(data, 1, len, fp) != len)   \
+               if (SC_FWRITE(data, 1, len, fp) != len) \
                        w_err = 1;                      \
                wrote += len;                           \
        } \
                        w_err = 1;                      \
                wrote += len;                           \
        } \
@@ -1022,11 +1035,15 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, MsgCache *c
                ftruncate(fileno(write_fps.cache_fp), write_fps.cache_size);
                ftruncate(fileno(write_fps.mark_fp), write_fps.mark_size);
        } else {
                ftruncate(fileno(write_fps.cache_fp), write_fps.cache_size);
                ftruncate(fileno(write_fps.mark_fp), write_fps.mark_size);
        } else {
+#ifdef HAVE_FWRITE_UNLOCKED
                flockfile(write_fps.cache_fp);
                flockfile(write_fps.mark_fp);
                flockfile(write_fps.cache_fp);
                flockfile(write_fps.mark_fp);
+#endif
                g_hash_table_foreach(cache->msgnum_table, msgcache_write_func, (gpointer)&write_fps);
                g_hash_table_foreach(cache->msgnum_table, msgcache_write_func, (gpointer)&write_fps);
+#ifdef HAVE_FWRITE_UNLOCKED
                funlockfile(write_fps.mark_fp);
                funlockfile(write_fps.cache_fp);
                funlockfile(write_fps.mark_fp);
                funlockfile(write_fps.cache_fp);
+#endif
        }
        
        fflush(write_fps.cache_fp);
        }
        
        fflush(write_fps.cache_fp);
index 7fdd8f9231b7d9181702dcaaa6acb8a129fe3e8d..d53601b262c771129e6c56cbb633206a26bf6905 100644 (file)
 #endif
 
 #define _GNU_SOURCE
 #endif
 
 #define _GNU_SOURCE
+#include <stdio.h>
+
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
         (CL(c.green) << (gulong)  8) | \
         (CL(c.blue)))
 
         (CL(c.green) << (gulong)  8) | \
         (CL(c.blue)))
 
+#ifdef HAVE_FGETS_UNLOCKED
+#define SC_FGETS fgets_unlocked
+#else
+#define SC_FGETS fgets
+#endif
+
 typedef enum
 {
        DUMMY_PARAM
 typedef enum
 {
        DUMMY_PARAM
@@ -88,10 +95,12 @@ void prefs_read_config(PrefParam *param, const gchar *label,
 
        block_label = g_strdup_printf("[%s]", label);
 
 
        block_label = g_strdup_printf("[%s]", label);
 
+#ifdef HAVE_FGETS_UNLOCKED
        flockfile(fp);
        flockfile(fp);
+#endif
 
        /* search aiming block */
 
        /* search aiming block */
-       while (fgets_unlocked(buf, sizeof(buf), fp) != NULL) {
+       while (SC_FGETS(buf, sizeof(buf), fp) != NULL) {
                gint val;
 
                if (encoding) {
                gint val;
 
                if (encoding) {
@@ -113,7 +122,7 @@ void prefs_read_config(PrefParam *param, const gchar *label,
        }
        g_free(block_label);
 
        }
        g_free(block_label);
 
-       while (fgets_unlocked(buf, sizeof(buf), fp) != NULL) {
+       while (SC_FGETS(buf, sizeof(buf), fp) != NULL) {
                strretchomp(buf);
                /* reached next block */
                if (buf[0] == '[') break;
                strretchomp(buf);
                /* reached next block */
                if (buf[0] == '[') break;
@@ -133,7 +142,9 @@ void prefs_read_config(PrefParam *param, const gchar *label,
        }
 
        debug_print("Finished reading configuration.\n");
        }
 
        debug_print("Finished reading configuration.\n");
+#ifdef HAVE_FGETS_UNLOCKED
        funlockfile(fp);
        funlockfile(fp);
+#endif
        fclose(fp);
 }
 
        fclose(fp);
 }
 
@@ -920,9 +931,11 @@ static int prefs_cache_sections(GHashTable *file_cache, const gchar *rcfile)
                return -1;
        }
        
                return -1;
        }
        
+#ifdef HAVE_FGETS_UNLOCKED
        flockfile(fp);
        flockfile(fp);
+#endif
        
        
-       while (fgets_unlocked(buf, sizeof(buf), fp) != NULL) {
+       while (SC_FGETS(buf, sizeof(buf), fp) != NULL) {
                strretchomp(buf);
                if (buf[0] == '\0')
                        continue;
                strretchomp(buf);
                if (buf[0] == '\0')
                        continue;
@@ -957,7 +970,9 @@ static int prefs_cache_sections(GHashTable *file_cache, const gchar *rcfile)
                        }
                }
        }
                        }
                }
        }
+#ifdef HAVE_FGETS_UNLOCKED
        funlockfile(fp);
        funlockfile(fp);
+#endif
        fclose(fp);
        return 0;
 }
        fclose(fp);
        return 0;
 }