Partially sync files.el from XEmacs 21.5 for wildcard support.
[sxemacs] / src / buffer.c
index 5a8fd89..922fa9c 100644 (file)
@@ -25,7 +25,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
    FSF: long ago.
    JWZ: some changes for Lemacs, long ago. (e.g. separate buffer
-        list per frame.)
+       list per frame.)
    Mly: a few changes for buffer-local vars, 19.8 or 19.9.
    Ben Wing: some changes and cleanups for Mule, 19.12.
  */
@@ -704,8 +704,8 @@ even if a buffer with that name exists.
 
        count = 1;
        while (1) {
-                prt = snprintf(number, sizeof(number), "<%d>", ++count);
-               assert(prt>=0 && (size_t)prt < sizeof(number));
+               prt = snprintf(number, sizeof(number), "<%d>", ++count);
+               assert(prt>=0 && (size_t)prt < sizeof(number));
                gentemp = concat2(name, build_string(number));
                if (!NILP(ignore)) {
                        tem = Fstring_equal(gentemp, ignore);
@@ -812,7 +812,7 @@ No argument or nil as argument means use current buffer as BUFFER.
     { int mask = XINT (buffer_local_flags.slot);               \
       if (mask == 0 || mask == -1                              \
          || ((mask > 0) && (buf->local_var_flags & mask)))     \
-        result = Fcons (Fcons (syms->slot, buf->slot), result);        \
+       result = Fcons (Fcons (syms->slot, buf->slot), result); \
     }
 #include "bufslots.h"
 #undef MARKED_SLOT
@@ -1618,7 +1618,7 @@ the normal hook `change-major-mode-hook'.
 
        kill_specifier_buffer_locals(Fcurrent_buffer());
 
-        changing_major_mode = 1;
+       changing_major_mode = 1;
 
        /* Force modeline redisplay.  Useful here because all major mode
           commands call this function.  */
@@ -1734,8 +1734,8 @@ typedef struct {
        Dynarr_declare(Extbyte_dynarr *);
 } Extbyte_dynarr_dynarr;
 
-static Extbyte_dynarr_dynarr *conversion_out_dynarr_list;
-static Bufbyte_dynarr_dynarr *conversion_in_dynarr_list;
+static Extbyte_dynarr_dynarr *conversion_out_dynarr_list = NULL;
+static Bufbyte_dynarr_dynarr *conversion_in_dynarr_list = NULL;
 
 static int dfc_convert_to_external_format_in_use;
 static int dfc_convert_to_internal_format_in_use;
@@ -1764,7 +1764,7 @@ dfc_convert_to_external_format(dfc_conversion_type source_type,
                               dfc_conversion_data * sink)
 {
        int count = specpdl_depth();
-       Extbyte_dynarr *conversion_out_dynarr;
+       Extbyte_dynarr *conversion_out_dynarr = NULL;
 
        type_checking_assert
            (((source_type == DFC_TYPE_DATA) ||
@@ -1778,6 +1778,7 @@ dfc_convert_to_external_format(dfc_conversion_type source_type,
 
        record_unwind_protect(dfc_convert_to_external_format_reset_in_use,
                              make_int(dfc_convert_to_external_format_in_use));
+       assert(conversion_out_dynarr_list != NULL);
        if (Dynarr_length(conversion_out_dynarr_list) <=
            dfc_convert_to_external_format_in_use)
                Dynarr_add(conversion_out_dynarr_list, Dynarr_new(Extbyte));
@@ -1920,7 +1921,7 @@ dfc_convert_to_internal_format(dfc_conversion_type source_type,
                               dfc_conversion_data * sink)
 {
        int count = specpdl_depth();
-       Bufbyte_dynarr *conversion_in_dynarr;
+       Bufbyte_dynarr *conversion_in_dynarr = NULL;
 
        type_checking_assert
            ((source_type == DFC_TYPE_DATA ||
@@ -1931,6 +1932,7 @@ dfc_convert_to_internal_format(dfc_conversion_type source_type,
 
        record_unwind_protect(dfc_convert_to_internal_format_reset_in_use,
                              make_int(dfc_convert_to_internal_format_in_use));
+       assert(conversion_in_dynarr_list != NULL);
        if (Dynarr_length(conversion_in_dynarr_list) <=
            dfc_convert_to_internal_format_in_use)
                Dynarr_add(conversion_in_dynarr_list, Dynarr_new(Bufbyte));
@@ -2681,7 +2683,7 @@ of the text area.
        DEFVAR_BUFFER_LOCAL_MAGIC("tab-width", tab_width        /*
 *Distance between tab stops (for display of tab characters), in columns.
 Automatically becomes buffer-local when set in any fashion.
-                                                                */ 
+                                                                */
                                  , redisplay_variable_changed);
 
        DEFVAR_BUFFER_LOCAL_MAGIC("ctl-arrow", ctl_arrow        /*
@@ -2696,7 +2698,7 @@ The interpretation of this variable is likely to change in the future.
 Automatically becomes buffer-local when set in any fashion.
 This variable does not apply to characters whose display is specified
 in the current display table (if there is one).
-                                                                */ 
+                                                                */
                                  , redisplay_variable_changed);
 
 #if 0                          /* #### Make this a specifier! */
@@ -2714,7 +2716,7 @@ Automatically becomes buffer-local when set in any fashion.
 Note that this is overridden by the variable
 `truncate-partial-width-windows' if that variable is non-nil
 and this buffer is not full-frame width.
-                                                                        */ 
+                                                                        */
                                  , redisplay_variable_changed);
 
        DEFVAR_BUFFER_LOCAL("default-directory", directory      /*
@@ -2723,7 +2725,7 @@ Each buffer has its own value of this variable.
                                                                 */ );
 
 #ifdef FILE_CODING
-       DEFVAR_BUFFER_DEFAULTS("default-buffer-file-coding-system", 
+       DEFVAR_BUFFER_DEFAULTS("default-buffer-file-coding-system",
                               buffer_file_coding_system        /*
 Default value of `buffer-file-coding-system' for buffers that do not override it.
 This is the same as (default-value 'buffer-file-coding-system).
@@ -3045,8 +3047,8 @@ static int directory_is_current_directory(Extbyte * pwd)
                   format anyway..
                */
                pwd_internal=pwd;
-               
-       } 
+
+       }
        if( pwd_internal == NULL ) {
                return 0;
        }
@@ -3070,8 +3072,8 @@ void init_initial_directory(void)
           when PWD is right, and may avoid a fatal error.  */
        if ((pwd = (Extbyte *) getenv("PWD")) != NULL
            && directory_is_current_directory(pwd)
-            && strlen(pwd) < sizeof(initial_directory) )
-                strcpy(initial_directory, (char *)pwd);
+           && strlen(pwd) < sizeof(initial_directory) )
+               strcpy(initial_directory, (char *)pwd);
        else
        if (getcwd(initial_directory, MAXPATHLEN) == NULL)
                fatal("`getcwd' failed: %s\n", strerror(errno));