1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-08 01:15:56 +01:00

WUtil: Added 'const' attribute on non-modified arguments to functions

A number of functions do not actually modify the strings given as
parameter, but only read or duplicate it. In this case it is a good
practice to mark that parameter as pointer-to-const to let the
compiler known about it, to be able to perform appropriate
optimisations.
This commit is contained in:
Christophe CURIS
2013-05-04 15:43:21 +02:00
committed by Carlos R. Mafra
parent ac89706859
commit bbf84eb0e8
4 changed files with 15 additions and 15 deletions

View File

@@ -502,22 +502,22 @@ static INLINE int getNonSpaceChar(PLData * pldata)
return c;
}
static char *unescapestr(char *src)
static char *unescapestr(const char *src)
{
char *dest = wmalloc(strlen(src) + 1);
char *sPtr, *dPtr;
char *dPtr;
char ch;
for (sPtr = src, dPtr = dest; *sPtr; sPtr++, dPtr++) {
if (*sPtr != '\\') {
*dPtr = *sPtr;
for (dPtr = dest; *src; src++, dPtr++) {
if (*src != '\\') {
*dPtr = *src;
} else {
ch = *(++sPtr);
ch = *(++src);
if ((ch >= '0') && (ch <= '3')) {
/* assume next 2 chars are octal too */
*dPtr = ((ch & 07) << 6);
*dPtr |= ((*(++sPtr) & 07) << 3);
*dPtr |= *(++sPtr) & 07;
*dPtr |= ((*(++src) & 07) << 3);
*dPtr |= *(++src) & 07;
} else {
switch (ch) {
case 'a':
@@ -542,7 +542,7 @@ static char *unescapestr(char *src)
*dPtr = '\f';
break;
default:
*dPtr = *sPtr;
*dPtr = *src;
}
}
}