Browse Source

const'ify some 'skip'ing functions

pre-master-46
rlar 10 years ago
parent
commit
7a42510cc0
  1. 2
      src/include/ngspice/ngspice.h
  2. 8
      src/include/ngspice/stringskip.h
  3. 4
      src/misc/string.c

2
src/include/ngspice/ngspice.h

@ -241,7 +241,7 @@ extern double x_atanh(double);
extern char *gettok_noparens(char **s);
extern char *gettok_node(char **s);
extern char *gettok_iv(char **s);
extern char *nexttok(char *s);
extern char *nexttok(const char *s);
extern int get_l_paren(char **s);
extern int get_r_paren(char **s);

8
src/include/ngspice/stringskip.h

@ -1,13 +1,13 @@
#ifndef ngspice_STRINGSKIP_H
#define ngspice_STRINGSKIP_H
static inline char *skip_non_ws(char *s) { while (*s && !isspace_c(*s)) s++; return s; }
static inline char *skip_ws(char *s) { while ( isspace_c(*s)) s++; return s; }
static inline char *skip_non_ws(const char *s) { while (*s && !isspace_c(*s)) s++; return (char *) s; }
static inline char *skip_ws(const char *s) { while ( isspace_c(*s)) s++; return (char *) s; }
static inline char *depreciated_skip_back_non_ws(char *s) { while (s[-1] && !isspace_c(s[-1])) s--; return s; }
static inline char *depreciated_skip_back_ws(char *s) { while (isspace_c(s[-1])) s--; return s; }
static inline char *skip_back_non_ws(char *s, char *start) { while (s > start && !isspace_c(s[-1])) s--; return s; }
static inline char *skip_back_ws(char *s, char *start) { while (s > start && isspace_c(s[-1])) s--; return s; }
static inline char *skip_back_non_ws(const char *s, const char *start) { while (s > start && !isspace_c(s[-1])) s--; return (char *) s; }
static inline char *skip_back_ws(const char *s, const char *start) { while (s > start && isspace_c(s[-1])) s--; return (char *) s; }
#endif

4
src/misc/string.c

@ -316,7 +316,7 @@ gettok(char **s)
* you have parens or commas anywhere in the nodelist.
*-------------------------------------------------------------------------*/
char *
nexttok(char *s)
nexttok(const char *s)
{
int paren = 0;
@ -335,7 +335,7 @@ nexttok(char *s)
while (isspace_c(*s) || *s == ',')
s++;
return s;
return (char *) s;
}

Loading…
Cancel
Save