Browse Source

misc/string.c, sprinkle some const'ness

pre-master-46
rlar 10 years ago
parent
commit
d37f18d777
  1. 2
      src/frontend/outitf.c
  2. 8
      src/include/ngspice/stringutil.h
  3. 10
      src/misc/string.c

2
src/frontend/outitf.c

@ -846,7 +846,7 @@ fileInit(runDesc *run)
static int static int
guess_type(char *name)
guess_type(const char *name)
{ {
int type; int type;

8
src/include/ngspice/stringutil.h

@ -12,14 +12,14 @@
#include <stdarg.h> #include <stdarg.h>
int prefix(register char *p, register char *s);
int prefix(const char *p, const char *s);
char * copy(const char *str); char * copy(const char *str);
char * copy_substring(const char *str, const char *end); char * copy_substring(const char *str, const char *end);
int substring(register char *sub, register char *str);
int substring(const char *sub, const char *str);
void appendc(char *s, char c); void appendc(char *s, char c);
int scannum(char *str); int scannum(char *str);
int cieq(register char *p, register char *s);
int ciprefix(register char *p, register char *s);
int cieq(const char *p, const char *s);
int ciprefix(const char *p, const char *s);
void strtolower(char *str); void strtolower(char *str);
void strtoupper(char *str); void strtoupper(char *str);
char * stripWhiteSpacesInsideParens(char *str); char * stripWhiteSpacesInsideParens(char *str);

10
src/misc/string.c

@ -14,7 +14,7 @@ Copyright 1990 Regents of the University of California. All rights reserved.
int int
prefix(register char *p, register char *s)
prefix(const char *p, const char *s)
{ {
while (*p && (*p == *s)) while (*p && (*p == *s))
p++, s++; p++, s++;
@ -106,9 +106,9 @@ tprintf(const char *fmt, ...)
/* Like strstr( ) XXX */ /* Like strstr( ) XXX */
int int
substring(register char *sub, register char *str)
substring(const char *sub, const char *str)
{ {
char *s, *t;
const char *s, *t;
while (*str) { while (*str) {
if (*str == *sub) { if (*str == *sub) {
@ -157,7 +157,7 @@ scannum(char *str)
/* Like strcasecmp( ) XXX */ /* Like strcasecmp( ) XXX */
int int
cieq(register char *p, register char *s)
cieq(const char *p, const char *s)
{ {
while (*p) { while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) != if ((isupper(*p) ? tolower(*p) : *p) !=
@ -172,7 +172,7 @@ cieq(register char *p, register char *s)
/* Case insensitive prefix. */ /* Case insensitive prefix. */
int int
ciprefix(register char *p, register char *s)
ciprefix(const char *p, const char *s)
{ {
while (*p) { while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) != if ((isupper(*p) ? tolower(*p) : *p) !=

Loading…
Cancel
Save