Changeset 3235 in kBuild for trunk/src/lib/quote_argv.c
- Timestamp:
- Oct 28, 2018 2:15:29 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/quote_argv.c
r2912 r3235 122 122 int fComplicated = pszQuotes || (cchOrg > 0 && pszOrg[cchOrg - 1] == '\\'); 123 123 size_t cchNew = fComplicated ? cchOrg * 2 + 2 : cchOrg + 2; 124 char *pszNew = (char *)malloc(cchNew + 1 /*term*/ + 3 /*passthru hack*/);124 char *pszNew = (char *)malloc(cchNew + 1 /*term*/); 125 125 if (!pszNew) 126 126 return -1; … … 138 138 else if (pszOrg[0] == '-' || pszOrg[0] == '/') /* Switch quoting. */ 139 139 { 140 const char *pszNeedQuoting; 140 141 if (isWatcomPassThruOption(pszOrg)) 141 cchUnquoted = strlen(pszOrg) + 1; 142 { 143 argv[i] = pszOrgOrg; 144 free(pszNew); 145 continue; /* No quoting needed, skip to the next argument. */ 146 } 147 148 pszNeedQuoting = (const char *)memchr(pszOrg, '=', cchOrg); /* For -i=dir and similar. */ 149 if ( pszNeedQuoting == NULL 150 || (uintptr_t)pszNeedQuoting > (uintptr_t)(pszProblem ? pszProblem : pszQuotes)) 151 pszNeedQuoting = pszProblem ? pszProblem : pszQuotes; 142 152 else 143 { 144 const char *pszNeedQuoting = (const char *)memchr(pszOrg, '=', cchOrg); /* For -i=dir and similar. */ 145 if ( pszNeedQuoting == NULL 146 || (uintptr_t)pszNeedQuoting > (uintptr_t)(pszProblem ? pszProblem : pszQuotes)) 147 pszNeedQuoting = pszProblem ? pszProblem : pszQuotes; 148 else 149 pszNeedQuoting++; 150 cchUnquoted = pszNeedQuoting - pszOrg; 151 } 153 pszNeedQuoting++; 154 cchUnquoted = pszNeedQuoting - pszOrg; 152 155 } 153 156 if (cchUnquoted)
Note:
See TracChangeset
for help on using the changeset viewer.