Fix build
authorNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 7 Mar 2012 01:50:52 +0000 (20:50 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 7 Mar 2012 01:50:52 +0000 (20:50 -0500)
* src/emodules-ng.c (__emodng_open_prepend_paths): Correct usage of xstpcpy size argument.
* src/emodules-ng.c (_adapt_load_path): Ditto.
* src/emodules-ng.c (__emodng_open_prepend_paths_append_exts): Fix indentation

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/emodules-ng.c

index 4124dc7..ba5493a 100644 (file)
@@ -189,7 +189,7 @@ __emodng_open_prepend_paths(const char *filename)
                        char *p;
                        p = xstpncpy(name,
                                     (const char*)XSTRING_DATA(XCAR(path)),
-                                    (size_t)XSTRING_LENGTH(XCAR(path)-2));
+                                    name+sizeof(name)-2);
                        *p++ = '/';
                        *p = '\0';
                        xstrncpy(p, filename, name + sizeof(name) - p);
@@ -223,10 +223,9 @@ __emodng_open_prepend_paths_append_exts(const char *filename)
                         * carries the correct extension
                         * see __emodng_open_prepend_paths_append_exts for
                         * cope with all the combinations */
-                       char *p = xstpncpy(
-                               name,
+                       char *p = xstpncpy(name,
                                (const char*)XSTRING_DATA(XCAR(path)),
-                               (size_t)XSTRING_LENGTH(XCAR(path))-2);
+                               name+sizeof(name)-2);
                        if (*(p-1) != '/') {
                                *p++ = '/';
                                *p = '\0';
@@ -845,7 +844,7 @@ _adapt_load_path(Lisp_Object sym, Lisp_Object *val,
                        if (LIKELY((STRINGP(lse)))) {
                                p = xstpncpy(p,
                                             (const char*)XSTRING_DATA(lse),
-                                            XSTRING_LENGTH(lse));
+                                            sp+sizeof(sp)-p-1);
                                *p++ = ':';
                        }
                }