On 15-Mar-2017 08:42, Bram Moolenaar wrote:
John Marriott wrote:

On 14 March 2017 at 19:17, John Marriott <[email protected] <mailto:[email protected]>> wrote:

    On 13-Mar-2017 05:22, Bram Moolenaar wrote:

        Patch 8.0.0451
        Problem:  Some macros are in lower case.
        Solution: Make a few more macros upper case. Avoid lower case
        macros use an
        argument twice.
        Files:  src/macros.h, src/charset.c, src/misc2.c,
        src/proto/misc2.pro <http://misc2.pro>,
         src/edit.c, src/eval.c, src/ex_cmds.c, src/ex_cmds2.c,
        src/ex_docmd.c, src/ex_getln.c, src/fileio.c, src/fold.c,
        src/gui.c, src/gui_gtk.c, src/mark.c, src/memline.c, src/mbyte.c,
        src/menu.c, src/message.c, src/misc1.c, src/ops.c, src/option.c,
        src/os_amiga.c, src/os_mswin.c, src/os_unix.c, src/os_win32.c,
        src/popupmnu.c, src/regexp.c, src/regexp_nfa.c, src/screen.c,
        src/search.c, src/spell.c, src/spellfile.c, src/syntax.c,
        src/tag.c, src/ui.c, src/undo.c, src/window.c



    After applying this patch, I get this error compiling on HPUX:
    ...
      cc -c -I. -Iproto -DHAVE_CONFIG_H -O2  -o objects/misc2.o misc2.c
    cc: "misc2.c", line 3387: error 1588: "n" undefined.
    cc: "misc2.c", line 3387: warning 563: Argument #1 is not the
    correct type.
    cc: "misc2.c", line 3387: warning 563: Argument #1 is not the
    correct type.
    cc: "misc2.c", line 3387: error 1588: "p" undefined.
    cc: "misc2.c", line 3387: warning 563: Argument #2 is not the
    correct type.
    *** Error exit code 1

    The attached patch seems to fix it.


Thanks.  Are all the type casts really needed? We can make
illegal_slash() also accept a const:

 illegal_slash(const char *name)

Then perhaps this works:

 return illegal_slash(name) ? -1 : stat(name, stp);

I hope stat() does take a "const char *" argument.


It turns out I was a bit generous with the type casts and the one in the call to stat() was not needed.

Anyhow, here is an updated patch with your suggestion of making illegal_slash() take a const. Builds ok on HPUX and Windows (mingw64).

Cheers
John

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
--- misc2.c.orig        2017-03-13 06:38:02.306170300 +1100
+++ misc2.c     2017-03-16 05:36:35.868874400 +1100
@@ -3365,7 +3365,7 @@
  * The Vim code assumes a trailing slash is only ignored for a directory.
  */
     static int
-illegal_slash(char *name)
+illegal_slash(const char *name)
 {
     if (name[0] == NUL)
        return FALSE;       /* no file name is not illegal */
@@ -3384,7 +3384,7 @@
 {
     /* On Solaris stat() accepts "file/" as if it was "file".  Return -1 if
      * the name ends in "/" and it's not a directory. */
-    return illegal_slash(n) ? -1 : stat(n, p);
+    return illegal_slash(name) ? -1 : stat(name, stp);
 }
 #endif
 

Raspunde prin e-mail lui