Shut set but unused warnings.
[sxemacs] / src / bytecode.c
index 8f6769b..8eb8186 100644 (file)
@@ -53,6 +53,7 @@ by Hallvard:
 #include "bytecode.h"
 #include "opaque.h"
 #include "syntax.h"
+#include "ent/ent.h"
 
 EXFUN(Ffetch_bytecode, 1);
 
@@ -1048,6 +1049,8 @@ execute_optimized_program(const Opbyte *program,
                        Lisp_Object args;
 
                        orig_fun = fun = XCAR(op);
+                       SXE_SET_UNUSED(orig_fun);
+
                        args = XCDR(op);
                        if (SYMBOLP (fun) && !EQ(fun, Qunbound) &&
                            (fun = XSYMBOL(fun)->function, SYMBOLP(fun)))
@@ -1328,9 +1331,11 @@ static void invalid_byte_code_error(char *error_message, ...)
 {
        Lisp_Object obj;
        va_list args;
-       char *buf = alloca_array(char, strlen(error_message) + 128);
+       int maxsz = strlen(error_message) + 128;
+       char *buf = alloca_array(char, maxsz);
 
-       sprintf(buf, "%s", error_message);
+       int sz=snprintf(buf, maxsz, "%s", error_message);
+       assert(sz>=0 && sz<maxsz);
        va_start(args, error_message);
        obj = emacs_doprnt_string_va((const Bufbyte *)GETTEXT(buf), Qnil, -1,
                                     args);
@@ -1790,7 +1795,6 @@ print_compiled_function(Lisp_Object obj, Lisp_Object printcharfun,
        int docp = f->flags.documentationp;
        int intp = f->flags.interactivep;
        struct gcpro gcpro1, gcpro2;
-       char buf[100];
        GCPRO2(obj, printcharfun);
 
        write_c_string(print_readably ? "#[" : "#<compiled-function ",
@@ -1816,9 +1820,8 @@ print_compiled_function(Lisp_Object obj, Lisp_Object printcharfun,
                NGCPRO1(instructions);
                if (STRINGP(instructions) && !print_readably) {
                        /* We don't usually want to see that junk in the bytecode. */
-                       sprintf(buf, "\"...(%ld)\"",
-                               (long)XSTRING_CHAR_LENGTH(instructions));
-                       write_c_string(buf, printcharfun);
+                       write_fmt_str(printcharfun, "\"...(%ld)\"",
+                                     (long)XSTRING_CHAR_LENGTH(instructions));
                } else
                        print_internal(instructions, printcharfun, escapeflag);
                NUNGCPRO;
@@ -1830,8 +1833,7 @@ print_compiled_function(Lisp_Object obj, Lisp_Object printcharfun,
                       escapeflag);
 
        /* COMPILED_STACK_DEPTH = 3 */
-       sprintf(buf, " %d", compiled_function_stack_depth(f));
-       write_c_string(buf, printcharfun);
+       write_fmt_str(printcharfun, " %d", compiled_function_stack_depth(f));
 
        /* COMPILED_DOC_STRING = 4 */
        if (docp || intp) {