ruby-changes:38078
From: nobu <ko1@a...>
Date: Sat, 4 Apr 2015 10:01:02 +0900 (JST)
Subject: [ruby-changes:38078] nobu:r50159 (trunk): stub.c: use argv[0] unchanged
nobu 2015-04-04 10:00:45 +0900 (Sat, 04 Apr 2015) New Revision: 50159 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50159 Log: stub.c: use argv[0] unchanged * win32/stub.c (stub_sysinit): use argv[0] unchanged and just insert full path name. Modified files: trunk/win32/stub.c Index: win32/stub.c =================================================================== --- win32/stub.c (revision 50158) +++ win32/stub.c (revision 50159) @@ -21,7 +21,7 @@ stub_sysinit(int *argc, char ***argv) https://github.com/ruby/ruby/blob/trunk/win32/stub.c#L21 for (i = 1; i < ac; ++i) { lenall += strlen(av[i]) + 1; } - av = realloc(av, lenall + (lenexe + 1) * 2 + sizeof(char *) * (i + 2)); + av = realloc(av, lenall + len0 + (lenexe + 1) + sizeof(char *) * (i + 2)); if (!av) { perror("realloc command line"); exit(-1); @@ -29,11 +29,10 @@ stub_sysinit(int *argc, char ***argv) https://github.com/ruby/ruby/blob/trunk/win32/stub.c#L29 *argv = av; *argc = ++ac; p = (char *)(av + i + 2); - memmove(p + (lenexe + 1) * 2, (char *)(av + ac) + len0, lenall); - memcpy(p, exename, lenexe); - p[lenexe] = '\0'; + memmove(p + len0 + lenexe + 1, (char *)(av + ac) + len0, lenall); + memmove(p, (char *)(av + ac), len0); *av++ = p; - p += lenexe + 1; + p += len0; memcpy(p, exename, lenexe); p[lenexe] = '\0'; *av++ = p; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/