Frédéric Delanoy : cmd: Make some WCHAR arrays static.

Alexandre Julliard julliard at winehq.org
Fri Aug 26 10:40:49 CDT 2011


Module: wine
Branch: master
Commit: ef70d88be06b5aa463093e9cf84c2c2cf5750b10
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ef70d88be06b5aa463093e9cf84c2c2cf5750b10

Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date:   Thu Aug 25 23:08:30 2011 +0200

cmd: Make some WCHAR arrays static.

---

 programs/cmd/builtins.c  |    8 ++++----
 programs/cmd/directory.c |    2 +-
 programs/cmd/wcmdmain.c  |   24 ++++++++++++------------
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 7b8f76d..99c4c3a 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -902,8 +902,8 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
   WIN32_FIND_DATAW fd;
   HANDLE hff;
   int i;
-  const WCHAR inW[] = {'i','n'};
-  const WCHAR doW[] = {'d','o'};
+  static const WCHAR inW[] = {'i','n'};
+  static const WCHAR doW[] = {'d','o'};
   CMD_LIST *setStart, *thisSet, *cmdStart, *cmdEnd;
   WCHAR variable[4];
   WCHAR *firstCmd;
@@ -1250,7 +1250,7 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
     if (isIF) processThese = conditionTRUE;
 
     while (*cmdList) {
-      const WCHAR ifElse[] = {'e','l','s','e'};
+      static const WCHAR ifElse[] = {'e','l','s','e'};
 
       /* execute all appropriate commands */
       curPosition = *cmdList;
@@ -1615,7 +1615,7 @@ void WCMD_move (void) {
         else if (strstrW (quals, parmY))
           force = TRUE;
         else {
-          const WCHAR copyCmdW[] = {'C','O','P','Y','C','M','D','\0'};
+          static const WCHAR copyCmdW[] = {'C','O','P','Y','C','M','D','\0'};
           len = GetEnvironmentVariableW(copyCmdW, copycmd, sizeof(copycmd)/sizeof(WCHAR));
           force = (len && len < (sizeof(copycmd)/sizeof(WCHAR))
                        && ! lstrcmpiW (copycmd, parmY));
diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c
index f397951..217f31c 100644
--- a/programs/cmd/directory.c
+++ b/programs/cmd/directory.c
@@ -878,7 +878,7 @@ void WCMD_directory (WCHAR *cmd) {
             strcatW (path, starW);
           }
           else {
-            const WCHAR slashStarW[]  = {'\\','*','\0'};
+            static const WCHAR slashStarW[]  = {'\\','*','\0'};
             strcatW (path, slashStarW);
           }
         }
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 63e8c16..04e1391 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -321,7 +321,7 @@ static void WCMD_show_prompt (void) {
   len = GetEnvironmentVariableW(envPrompt, prompt_string,
                                 sizeof(prompt_string)/sizeof(WCHAR));
   if ((len == 0) || (len >= (sizeof(prompt_string)/sizeof(WCHAR)))) {
-    const WCHAR dfltPrompt[] = {'$','P','$','G','\0'};
+    static const WCHAR dfltPrompt[] = {'$','P','$','G','\0'};
     strcpyW (prompt_string, dfltPrompt);
   }
   p = prompt_string;
@@ -1048,7 +1048,7 @@ void WCMD_run_program (WCHAR *command, int called) {
     WCHAR  thisDir[MAX_PATH] = {'\0'};
     WCHAR *pos               = NULL;
     BOOL  found             = FALSE;
-    const WCHAR slashW[] = {'\\','\0'};
+    static const WCHAR slashW[] = {'\\','\0'};
 
     /* Work on the first directory on the search path */
     pos = strchrW(pathposn, ';');
@@ -1753,10 +1753,10 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
     CMD_LIST *lastEntry = NULL;
     CMD_DELIMITERS prevDelim = CMD_NONE;
     static WCHAR    *extraSpace = NULL;  /* Deliberately never freed */
-    const WCHAR remCmd[] = {'r','e','m'};
-    const WCHAR forCmd[] = {'f','o','r'};
-    const WCHAR ifCmd[]  = {'i','f'};
-    const WCHAR ifElse[] = {'e','l','s','e'};
+    static const WCHAR remCmd[] = {'r','e','m'};
+    static const WCHAR forCmd[] = {'f','o','r'};
+    static const WCHAR ifCmd[]  = {'i','f'};
+    static const WCHAR ifElse[] = {'e','l','s','e'};
     BOOL      inRem = FALSE;
     BOOL      inFor = FALSE;
     BOOL      inIn  = FALSE;
@@ -1799,9 +1799,9 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
     if (context) handleExpansion(extraSpace, FALSE, NULL, NULL);
     /* Show prompt before batch line IF echo is on and in batch program */
     if (context && echo_mode && extraSpace[0] && (extraSpace[0] != '@')) {
-      const WCHAR spc[]={' ','\0'};
-      const WCHAR echoDot[] = {'e','c','h','o','.'};
-      const WCHAR echoCol[] = {'e','c','h','o',':'};
+      static const WCHAR spc[]={' ','\0'};
+      static const WCHAR echoDot[] = {'e','c','h','o','.'};
+      static const WCHAR echoCol[] = {'e','c','h','o',':'};
       const DWORD len = sizeof(echoDot)/sizeof(echoDot[0]);
       DWORD curr_size = strlenW(extraSpace);
       DWORD min_len = (curr_size < len ? curr_size : len);
@@ -1838,7 +1838,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
 
       /* Certain commands need special handling */
       if (curStringLen == 0 && curCopyTo == curString) {
-        const WCHAR forDO[] = {'d','o'};
+        static const WCHAR forDO[] = {'d','o'};
 
         /* If command starts with 'rem ', ignore any &&, ( etc. */
         if (WCMD_keyword_ws_found(remCmd, sizeof(remCmd)/sizeof(remCmd[0]), curPos)) {
@@ -1884,7 +1884,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
 
         /* Special handling for the 'FOR' command */
         if (inFor && lastWasWhiteSpace) {
-          const WCHAR forIN[] = {'i','n'};
+          static const WCHAR forIN[] = {'i','n'};
 
           WINE_TRACE("Found 'FOR ', comparing next parm: '%s'\n", wine_dbgstr_w(curPos));
 
@@ -2296,7 +2296,7 @@ int wmain (int argc, WCHAR *argvW[])
   }
 
   if (opt_q) {
-    const WCHAR eoff[] = {'O','F','F','\0'};
+    static const WCHAR eoff[] = {'O','F','F','\0'};
     WCMD_echo(eoff);
   }
 




More information about the wine-cvs mailing list