qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs Makefile buffer.c configure input.c kmap...


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs Makefile buffer.c configure input.c kmap...
Date: Sat, 05 Apr 2008 23:04:57 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        08/04/05 23:04:57

Modified files:
        .              : Makefile buffer.c configure input.c kmap.c qe.c 
                         qe.h unix.c util.c variables.c win32.c 

Log message:
        fixed some configure issues for mingw compile under cygwin
        added CONFIG_MMAP to control availability of memory mapped files
        added CONFIG_DOC to control doc rebuild
        use state variables to control file mmapping and loading
        default limit of 512MB for loading file
        try and load the file upon mmap failure
        do not use alloca in CONFIG_WIN32
        use CONFIG_WIN32 instead of WIN32
        update Makefile to enable win32 build under cygwin (dumps core)
        renamed mouse_event to prevent compile warning
        patched unix.c util.c win32.c to enable WIN32 compile
        fixed kmap.c to load mapping files when mmap fails or is unavailable

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/Makefile?cvsroot=qemacs&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/qemacs/configure?cvsroot=qemacs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/qemacs/input.c?cvsroot=qemacs&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/qemacs/kmap.c?cvsroot=qemacs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.77&r2=1.78
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/qemacs/unix.c?cvsroot=qemacs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/qemacs/util.c?cvsroot=qemacs&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/qemacs/variables.c?cvsroot=qemacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/qemacs/win32.c?cvsroot=qemacs&r1=1.12&r2=1.13

Patches:
Index: Makefile
===================================================================
RCS file: /cvsroot/qemacs/qemacs/Makefile,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- Makefile    4 Apr 2008 18:23:10 -0000       1.36
+++ Makefile    5 Apr 2008 23:04:56 -0000       1.37
@@ -24,7 +24,6 @@
   # do not warn about zero-length formats.
   CFLAGS   += -Wno-format-zero-length
   LDFLAGS  := -g
-  TLDFLAGS := -g
 endif
 
 #include local compiler configuration file
@@ -33,9 +32,10 @@
 ifdef TARGET_GPROF
   CFLAGS   += -p
   LDFLAGS  += -p
-  TLDFLAGS += -p
 endif
 
+TLDFLAGS := $(LDFLAGS)
+
 ifdef TARGET_ARCH_X86
   #CFLAGS+=-fomit-frame-pointer
   ifeq ($(GCC_MAJOR),2)
@@ -68,20 +68,23 @@
   LDFLAGS+=-Wl,-E
 endif
 
-LIBS+=-lm
-
-ifndef CONFIG_CYGWIN
-  TARGETS+=qe-doc.html
+ifdef CONFIG_DOC
+  TARGETS+= qe-doc.html
 endif
 
 ifdef CONFIG_WIN32
+  OBJS+= unix.o
+  TOBJS+= unix.o
   OBJS+= win32.o
   TOBJS+= win32.o
-  LIBS+= -lgdi32
-  TLIBS+= -lgdi32
+#  OBJS+= printf.o
+#  TOBJS+= printf.o
+  LIBS+= -lmsvcrt -lgdi32 -lwsock32
+  TLIBS+= -lmsvcrt -lgdi32 -lwsock32
 else
   OBJS+= unix.o tty.o
   TOBJS+= unix.o tty.o
+  LIBS+= -lm
 endif
 
 ifdef CONFIG_ALL_KMAPS
@@ -98,10 +101,10 @@
 endif
 
 ifdef CONFIG_ALL_MODES
-  OBJS+= unihex.o clang.o latex-mode.o xml.o bufed.o \
+  OBJS+= unihex.o clang.o xml.o bufed.o \
          lisp.o makemode.o perl.o htmlsrc.o script.o variables.o
   ifndef CONFIG_WIN32
-    OBJS+= shell.o dired.o
+    OBJS+= shell.o dired.o latex-mode.o
   endif
 endif
 
@@ -160,7 +163,7 @@
 qe$(EXE): qe_g$(EXE) Makefile
        rm -f $@
        cp $< $@
-       $(STRIP) $@
+       -$(STRIP) $@
        @ls -l $@
        echo `size address@hidden `wc --bytes address@hidden qe $(OPTIONS) \
                | cut -d ' ' -f 7-10,13,15-40 >> STATS
@@ -174,7 +177,7 @@
 tqe$(EXE): tqe_g$(EXE) Makefile
        rm -f $@
        cp $< $@
-       $(STRIP) $@
+       -$(STRIP) $@
        @ls -l $@
        echo `size address@hidden `wc --bytes address@hidden tqe $(OPTIONS) \
                | cut -d ' ' -f 7-10,13,15-40 >> STATS

Index: buffer.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/buffer.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- buffer.c    30 Mar 2008 16:10:15 -0000      1.37
+++ buffer.c    5 Apr 2008 23:04:56 -0000       1.38
@@ -20,7 +20,7 @@
  */
 
 #include "qe.h"
-#ifndef WIN32
+#ifdef CONFIG_MMAP
 #include <sys/mman.h>
 #endif
 
@@ -1374,12 +1374,9 @@
     return size;
 }
 
+#ifdef CONFIG_MMAP
 int mmap_buffer(EditBuffer *b, const char *filename)
 {
-#ifdef WIN32
-    /* currently no mmap is used under Windows */
-    return -1;
-#else
     int fd, len, file_size, n, size;
     u8 *file_ptr, *ptr;
     Page *p;
@@ -1419,20 +1416,29 @@
     b->file_handle = fd;
     //put_status(NULL, "");
     return 0;
-#endif
 }
+#endif
 
 static int raw_load_buffer(EditBuffer *b, FILE *f)
 {
-    int ret;
+    QEmacsState *qs = &qe_state;
     struct stat st;
 
-    if (stat(b->filename, &st) == 0 && st.st_size >= MIN_MMAP_SIZE) {
-        ret = mmap_buffer(b, b->filename);
-    } else {
-        ret = raw_load_buffer1(b, f, 0);
+    /* TODO: Should produce error messages */
+
+    if (stat(b->filename, &st))
+        return -1;
+
+#ifdef CONFIG_MMAP
+    if (st.st_size >= qs->mmap_threshold) {
+        if (mmap_buffer(b, b->filename))
+            return 0;
     }
-    return ret;
+#endif
+    if (st.st_size <= qs->max_load_size) {
+        return raw_load_buffer1(b, f, 0);
+    }
+    return -1;
 }
 
 /* Write bytes between <start> and <end> to file filename,
@@ -1507,11 +1513,19 @@
     if (len >= size) {
         va_start(ap, fmt);
         size = len + 1;
+#ifdef CONFIG_WIN32
+        buf = malloc(size);
+#else
         buf = alloca(size);
+#endif
         vsnprintf(buf, size, fmt, ap);
         va_end(ap);
     }
     eb_insert(b, b->total_size, buf, len);
+#ifdef CONFIG_WIN32
+    if (buf != buf0)
+        free(buf);
+#endif
     return len;
 }
 
@@ -1750,7 +1764,7 @@
     if (ret < 0)
         return ret;
 
-#ifndef WIN32
+#ifndef CONFIG_WIN32
     /* set correct file mode to old file permissions */
     chmod(filename, mode);
 #endif

Index: configure
===================================================================
RCS file: /cvsroot/qemacs/qemacs/configure,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- configure   10 Jan 2008 12:21:05 -0000      1.10
+++ configure   5 Apr 2008 23:04:57 -0000       1.11
@@ -40,12 +40,13 @@
     cpu="unknown"
     ;;
 esac
+
 gprof="no"
 network="yes"
 win32="no"
 cygwin="no"
 lshared="no"
-extralibs="-lm"
+extralibs=""
 simpleidct="yes"
 bigendian="no"
 mpegaudio_hp="yes"
@@ -57,8 +58,10 @@
 png="no"
 ffmpeg="no"
 html="no"
+doc="yes"
 plugins="yes"
 initcalls="yes"
+mmap="yes"
 kmaps="yes"
 modes="yes"
 bidir="yes"
@@ -74,10 +77,10 @@
     # no need for libm, but the inet stuff
     # Check for BONE
     if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
-        extralibs="-lbind -lsocket"
+        extralibs="-lbind -lsocket -lm"
     else
         echo "Not sure building for net_server will succeed... good luck."
-        extralibs="-lsocket"
+        extralibs="-lsocket -lm"
     fi
     ;;
   BSD/OS)
@@ -88,6 +91,7 @@
     cygwin="yes"
     ;;
   *)
+    extralibs="-lm"
     ;;
 esac
 
@@ -205,19 +209,27 @@
 fi
 
 if test "$win32" = "yes" ; then
+    if test "$cygwin" = "yes" ; then
+        cross_prefix="i686-pc-mingw32-"
+        gcc_major="3"
+       CFLAGS="$CFLAGS -I/usr/include/mingw -I/usr/include/w32api"
+       LDFLAGS="$LDFLAGS -L/usr/lib/mingw"
+    else
     cross_prefix="i386-mingw32msvc-"
+    fi
     network="no"
-    exe=".exe"
-    x11="no"
+    doc="no"
     plugins="no"
-    kmaps="no"
+    initcalls="no"
+    x11="no"
+    mmap="no"
+    cygwin="no"
+    exe=".exe"
 fi
 
 if test "$cygwin" = "yes" ; then
-    plugins="no"
+    doc="no"
     x11="no"
-    xv="no"
-    xrender="no"
     png="no"
     ffmpeg="no"
     html="no"
@@ -351,14 +363,16 @@
 echo "Xvideo support   $xv"
 #echo "Xrender support  $xrender"
 echo "libpng support   $png"
+echo "FFMPEG support      $ffmpeg"
 echo "Graphical HTML   $html"
-echo "Plugins support  $plugins"
+echo "Memory mapped files $mmap"
 echo "Initcall support $initcalls"
+echo "Plugins support     $plugins"
+echo "Bidir support       $bidir"
 echo "All kmaps        $kmaps"
 echo "All modes        $modes"
-echo "Bidir support    $bidir"
-echo "FFMPEG support   $ffmpeg"
-
+echo "Build doc files     $doc"
+echo ""
 echo "Creating config.mak and config.h"
 
 echo "# Automatically generated by configure - do not modify" > config.mak
@@ -475,6 +489,11 @@
   echo "CONFIG_ALL_KMAPS=yes" >> config.mak
 fi
 
+if test "$mmap" = "yes" ; then
+  echo "#define CONFIG_MMAP 1" >> $TMPH
+  echo "CONFIG_MMAP=yes" >> config.mak
+fi
+
 if test "$modes" = "yes" ; then
   echo "#define CONFIG_ALL_MODES 1" >> $TMPH
   echo "CONFIG_ALL_MODES=yes" >> config.mak
@@ -485,6 +504,11 @@
   echo "CONFIG_UNICODE_JOIN=yes" >> config.mak
 fi
 
+if test "$doc" = "yes" ; then
+  echo "#define CONFIG_DOC 1" >> $TMPH
+  echo "CONFIG_DOC=yes" >> config.mak
+fi
+
 # build tree in object directory if source path is different from current one
 if test "$source_path_used" = "yes" ; then
     DIRS="tests"

Index: input.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/input.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- input.c     11 Jan 2008 11:29:29 -0000      1.20
+++ input.c     5 Apr 2008 23:04:57 -0000       1.21
@@ -20,9 +20,6 @@
  */
 
 #include "qe.h"
-#ifndef WIN32
-#include <sys/mman.h>
-#endif
 
 static int default_input(__unused__ int *match_buf,
                          __unused__ int match_buf_size,

Index: kmap.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/kmap.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- kmap.c      10 Jan 2008 12:21:05 -0000      1.1
+++ kmap.c      5 Apr 2008 23:04:57 -0000       1.2
@@ -20,7 +20,7 @@
  */
 
 #include "qe.h"
-#ifndef WIN32
+#ifdef CONFIG_MMAP
 #include <sys/mman.h>
 #endif
 
@@ -161,40 +161,50 @@
     }
 }
 
-static int input_method_fd;
-static size_t input_method_size;
+#ifdef CONFIG_MMAP
 static void *input_method_map;
+static size_t input_method_size;
+#endif
+static void *input_method_ptr;
 
-void load_input_methods(void)
+int load_input_methods(void)
 {
     char buf[MAX_FILENAME_SIZE];
-    size_t file_size;
+    ssize_t file_size;
     int fd, offset;
-    const unsigned char *file_ptr, *p;
+    const unsigned char *file_ptr = NULL, *p;
     InputMethod *m;
 
-    input_method_fd = -1;
-
     if (find_resource_file(buf, sizeof(buf), "kmaps") < 0)
-        return;
+        return -1;
 
     fd = open(buf, O_RDONLY);
     if (fd < 0)
-        return;
+        return -1;
+
     file_size = lseek(fd, 0, SEEK_END);
-    file_ptr = mmap(NULL, file_size, PROT_READ, MAP_SHARED, fd, 0);
-    if ((void*)file_ptr == (void*)MAP_FAILED) {
-        // XXX: allocate a buffer and read the file in memory
-    fail:
-        // XXX: print error message
-        close(fd);
-        return;
-    }
+    if (file_size <= 0)
+        goto fail;
+
+    lseek(fd, 0, SEEK_SET);
 
-    if (memcmp(file_ptr, "kmap", 4) != 0) {
-        munmap((void*)file_ptr, file_size);
+#ifdef CONFIG_MMAP
+    input_method_map = mmap(NULL, file_size, PROT_READ, MAP_SHARED, fd, 0);
+    if (input_method_map != (void*)MAP_FAILED) {
+        file_ptr = input_method_map;
+        input_method_size = file_size;
+    }
+#endif
+    if (!file_ptr) {
+        file_ptr = input_method_ptr = qe_malloc_array(char, file_size);
+        if (input_method_ptr == NULL
+        ||  read(fd, input_method_ptr, file_size) != file_size) {
         goto fail;
     }
+    }
+
+    if (memcmp(file_ptr, "kmap", 4) != 0)
+        goto fail;
 
     p = file_ptr + 4;
     for (;;) {
@@ -202,6 +212,7 @@
         p += 4;
         if (offset == 0)
             break;
+        /* Should add validation tests */
         m = qe_malloc(InputMethod);
         if (m) {
             m->data = file_ptr + offset;
@@ -211,18 +222,23 @@
         }
         p += strlen((const char *)p) + 1;
     }
+    return 0;
 
-    input_method_fd = fd;
-    input_method_map = (void *)file_ptr;
-    input_method_size = file_size;
+  fail:
+    unload_input_methods();
+    close(fd);
+    return -1;
 }
 
 void unload_input_methods(void)
 {
-    if (input_method_fd >= 0) {
-        munmap((void*)input_method_map, input_method_size);
+    /* Should unregister input methods, but this is only called upon exit */
+#ifdef CONFIG_MMAP
+    if (input_method_map && input_method_map != (void*)MAP_FAILED) {
+        munmap(input_method_map, input_method_size);
         input_method_map = NULL;
-        close(input_method_fd);
-        input_method_fd = -1;
+        input_method_size = 0;
     }
+#endif
+    qe_free(&input_method_ptr);
 }

Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- qe.c        4 Apr 2008 12:06:07 -0000       1.77
+++ qe.c        5 Apr 2008 23:04:57 -0000       1.78
@@ -2132,7 +2132,7 @@
 {
     QEStyleDef *s;
 
-#ifndef WIN32
+#ifndef CONFIG_WIN32
     if (style_index & QE_STYLE_TTY) {
         style->fg_color = tty_fg_colors[TTY_GET_XFG(style_index)];
         style->bg_color = tty_bg_colors[TTY_GET_BG(style_index)];
@@ -4234,7 +4234,7 @@
             } else {
                 int argval = c->argval;
 
-                /* To allow recursive all to qe_key_process, especially
+                /* To allow recursive calls to qe_key_process, especially
                  * from macros, we reset the QEKeyContext before
                  * dispatching the command
                  */
@@ -6558,7 +6558,7 @@
     }
 }
 
-#ifdef WIN32
+#ifdef CONFIG_WIN32
 
 void qe_event_init(void)
 {
@@ -6739,7 +6739,7 @@
     perform_scroll_up_down(s, dir * WHEEL_SCROLL_STEP * line_height);
 }
 
-void mouse_event(QEEvent *ev)
+void qe_mouse_event(QEEvent *ev)
 {
     QEmacsState *qs = &qe_state;
     EditState *e;
@@ -6908,7 +6908,7 @@
     case QE_BUTTON_PRESS_EVENT:
     case QE_BUTTON_RELEASE_EVENT:
     case QE_MOTION_EVENT:
-        mouse_event(ev);
+        qe_mouse_event(ev);
         break;
     case QE_SELECTION_CLEAR_EVENT:
         save_selection();
@@ -7658,6 +7658,8 @@
     qs->argv = argv;
 
     qs->hilite_region = 1;
+    qs->mmap_threshold = MIN_MMAP_SIZE;
+    qs->max_load_size = MAX_LOAD_SIZE;
 
     /* setup resource path */
     set_user_option(NULL);
@@ -7767,7 +7769,7 @@
         /* CG: handle +linenumber */
     }
 
-#ifndef CONFIG_TINY
+#if !defined(CONFIG_TINY) && !defined(CONFIG_WIN32)
     if (is_player && _optind >= argc) {
         /* if player, go to directory mode by default if no file selected */
         do_dired(s);

Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- qe.h        4 Apr 2008 13:11:17 -0000       1.75
+++ qe.h        5 Apr 2008 23:04:57 -0000       1.76
@@ -42,7 +42,7 @@
 
 /* OS specific defines */
 
-#ifdef WIN32
+#ifdef CONFIG_WIN32
 #define snprintf   _snprintf
 #define vsnprintf  _vsnprintf
 #endif
@@ -626,6 +626,7 @@
 
 /* begin to mmap files from this size */
 #define MIN_MMAP_SIZE (1024*1024)
+#define MAX_LOAD_SIZE  (512*1024*1024)
 
 #define MAX_PAGE_SIZE 4096
 //#define MAX_PAGE_SIZE 16
@@ -1195,6 +1196,7 @@
     int ignore_spaces;  /* ignore spaces when comparing windows */
     int hilite_region;  /* hilite the current region when selecting */
     int mmap_threshold; /* minimum file size for mmap */
+    int max_load_size;  /* maximum file size for loading in memory */
 };
 
 extern QEmacsState qe_state;
@@ -1424,7 +1426,7 @@
 void do_set_input_method(EditState *s, const char *method);
 void do_switch_input_method(EditState *s);
 void init_input_methods(void);
-void load_input_methods(void);
+int load_input_methods(void);
 void unload_input_methods(void);
 
 /* the following will be suppressed */
@@ -1466,7 +1468,7 @@
 void file_completion(CompleteState *cp);
 void buffer_completion(CompleteState *cp);
 
-#ifdef WIN32
+#ifdef CONFIG_WIN32
 static inline int is_user_input_pending(void) {
     return 0;
 }
@@ -1684,7 +1686,7 @@
 void window_get_min_size(EditState *s, int *w_ptr, int *h_ptr);
 void window_resize(EditState *s, int target_w, int target_h);
 void wheel_scroll_up_down(EditState *s, int dir);
-void mouse_event(QEEvent *ev);
+void qe_mouse_event(QEEvent *ev);
 int parse_config_file(EditState *s, const char *filename);
 int parse_command_line(int argc, char **argv);
 void set_user_option(const char *user);

Index: unix.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/unix.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- unix.c      3 Jan 2008 09:51:32 -0000       1.6
+++ unix.c      5 Apr 2008 23:04:57 -0000       1.7
@@ -19,7 +19,15 @@
  */
 
 #include "qe.h"
+
+#ifdef CONFIG_WIN32
+#include <winsock.h>
+/* Use a conditional typedef to avoid compilation warning */
+typedef u_int fdesc_t;
+#else
 #include <sys/wait.h>
+typedef int fdesc_t;
+#endif
 
 /* NOTE: it is strongly inspirated from the 'links' browser API */
 
@@ -66,9 +74,9 @@
     if (cb) {
         if (fd >= url_fdmax)
             url_fdmax = fd;
-        FD_SET(fd, &url_rfds);
+        FD_SET((fdesc_t)fd, &url_rfds);
     } else {
-        FD_CLR(fd, &url_rfds);
+        FD_CLR((fdesc_t)fd, &url_rfds);
     }
 }
 
@@ -79,9 +87,9 @@
     if (cb) {
         if (fd >= url_fdmax)
             url_fdmax = fd;
-        FD_SET(fd, &url_wfds);
+        FD_SET((fdesc_t)fd, &url_wfds);
     } else {
-        FD_CLR(fd, &url_wfds);
+        FD_CLR((fdesc_t)fd, &url_wfds);
     }
 }
 
@@ -234,9 +242,8 @@
 static void url_block(void)
 {
     URLHandler *uh;
-    int ret, i, pid, status, delay;
+    int ret, i, delay;
     fd_set rfds, wfds;
-    PidHandler *ph, *ph1;
     struct timeval tv;
 
     delay = check_timers(MAX_DELAY);
@@ -270,8 +277,12 @@
         }
     }
 
+#ifndef CONFIG_WIN32
     /* handle terminated children */
     for (;;) {
+        int pid, status;
+        PidHandler *ph, *ph1;
+
         if (list_empty(&pid_handlers))
             break;
         pid = waitpid(-1, &status, WNOHANG);
@@ -285,6 +296,7 @@
             }
         }
     }
+#endif
 }
 
 void url_main_loop(void (*init)(void *opaque), void *opaque)

Index: util.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/util.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- util.c      30 Mar 2008 12:02:01 -0000      1.43
+++ util.c      5 Apr 2008 23:04:57 -0000       1.44
@@ -22,13 +22,13 @@
 #include "qe.h"
 #include <dirent.h>
 
-#ifdef WIN32
+#ifdef CONFIG_WIN32
 #include <sys/timeb.h>
 
 /* XXX: not sufficient, but OK for basic operations */
 int fnmatch(const char *pattern, const char *string, int flags)
 {
-    if (pattern[0] == '*')
+    if (pattern[0] == '*' && pattern[1] == '\0')
         return 0;
     else
         return !strequal(pattern, string);
@@ -112,16 +112,15 @@
     qe_free(&s);
 }
 
-#ifdef WIN32
+#ifdef CONFIG_WIN32
 /* convert '\' to '/' */
 static void path_win_to_unix(char *buf)
 {
     char *p;
-    p = buf;
-    while (*p) {
+
+    for (p = buf; *p; p++) {
         if (*p == '\\')
             *p = '/';
-        p++;
     }
 }
 #endif
@@ -250,7 +249,7 @@
                 homedir = getenv("HOME");
                 if (homedir) {
                     pstrcpy(path, sizeof(path), homedir);
-#ifdef WIN32
+#ifdef CONFIG_WIN32
                     path_win_to_unix(path);
 #endif
                     remove_slash(path);
@@ -267,7 +266,7 @@
             /* CG: not sufficient for windows drives */
             /* CG: should test result */
             getcwd(cwd, sizeof(cwd));
-#ifdef WIN32
+#ifdef CONFIG_WIN32
             path_win_to_unix(cwd);
 #endif
             makepath(path, sizeof(path), cwd, path1);
@@ -286,7 +285,7 @@
     base = filename;
     if (base) {
         for (p = base; *p; p++) {
-#ifdef WIN32
+#ifdef CONFIG_WIN32
             /* Simplistic DOS filename support */
             if (*p == '/' || *p == '\\' || *p == ':')
                 base = p + 1;

Index: variables.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/variables.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- variables.c 29 Mar 2008 18:06:41 -0000      1.3
+++ variables.c 5 Apr 2008 23:04:57 -0000       1.4
@@ -34,6 +34,7 @@
     S_VAR( "ignore-spaces", ignore_spaces, VAR_NUMBER, VAR_RW )
     S_VAR( "hilite-region", hilite_region, VAR_NUMBER, VAR_RW )
     S_VAR( "mmap-threshold", mmap_threshold, VAR_NUMBER, VAR_RW )
+    S_VAR( "max-load-size", max_load_size, VAR_NUMBER, VAR_RW )
     S_VAR( "show-unicode", show_unicode, VAR_NUMBER, VAR_RW )
 
 

Index: win32.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/win32.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- win32.c     11 Jan 2008 11:29:29 -0000      1.12
+++ win32.c     5 Apr 2008 23:04:57 -0000       1.13
@@ -256,7 +256,7 @@
     case WM_KEYDOWN:
         {
             unsigned int scan;
-            int ctrl, shift, alt, key;
+            int ctrl, shift, alt;
 
             ctrl = (GetKeyState(VK_CONTROL) & 0x8000);
             shift = (GetKeyState(VK_SHIFT) & 0x8000);
@@ -396,7 +396,8 @@
     return 0;
 }
 
-static int get_unicode_key(QEditScreen *s, QEPollData *pd, QEEvent *ev)
+typedef struct QEPollData QEPollData;
+int get_unicode_key(QEditScreen *s, QEPollData *pd, QEEvent *ev)
 {
     MSG msg;
     QEEventQ *e;
@@ -521,7 +522,7 @@
     NULL, /* next */
 };
 
-int win32_init(void)
+static int win32_init(void)
 {
     return qe_register_display(&win32_dpy);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]