use strchr() instead of index()
This commit is contained in:
parent
4ae0ee137c
commit
f285dd0aa8
15
ChangeLog
15
ChangeLog
|
|
@ -1,3 +1,18 @@
|
|||
2012-02-06 Robert Larice
|
||||
* src/frontend/com_compose.c ,
|
||||
* src/frontend/define.c ,
|
||||
* src/frontend/device.c ,
|
||||
* src/frontend/inpcom.c ,
|
||||
* src/frontend/parse.c ,
|
||||
* src/frontend/vectors.c ,
|
||||
* src/frontend/parser/complete.c ,
|
||||
* src/frontend/parser/unixcom.c ,
|
||||
* src/frontend/wdisp/windisp.c ,
|
||||
* src/include/ngspice/ngspice.h ,
|
||||
* src/spicelib/parser/inpptree.c :
|
||||
use strchr() instead of index()
|
||||
which is depreciated
|
||||
|
||||
============================ ngspice-24 ==================================
|
||||
2012-01-30 Dietmar Warning
|
||||
* src/spicelib/devices/dio/diotemp.c: Add temperature dependent
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ com_compose(wordlist *wl)
|
|||
var = wl->wl_word;
|
||||
val = s + 1;
|
||||
wl = wl->wl_next;
|
||||
} else if (index(wl->wl_word, '=')) {
|
||||
} else if (strchr(wl->wl_word, '=')) {
|
||||
/* This is var= val. */
|
||||
*s = '\0';
|
||||
var = wl->wl_word;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ com_define(wordlist *wlist)
|
|||
* to try really hard to break this here.
|
||||
*/
|
||||
buf[0] = '\0';
|
||||
for (wl = wlist; wl && (index(wl->wl_word, /* ( */ ')') == NULL);
|
||||
for (wl = wlist; wl && (strchr(wl->wl_word, /* ( */ ')') == NULL);
|
||||
wl = wl->wl_next)
|
||||
(void) strcat(buf, wl->wl_word);
|
||||
if (wl) {
|
||||
|
|
|
|||
|
|
@ -1353,7 +1353,7 @@ devexpand(char *name)
|
|||
{
|
||||
wordlist *wl, *devices, *tw;
|
||||
|
||||
if (index(name, '*') ||strchr(name, '[') ||strchr(name, '?')) {
|
||||
if (strchr(name, '*') || strchr(name, '[') || strchr(name, '?')) {
|
||||
devices = cp_cctowl(ft_curckt->ci_devices);
|
||||
for (wl = NULL; devices; devices = devices->wl_next)
|
||||
if (cp_globmatch(name, devices->wl_word)) {
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@ inp_pathopen(char *name, char *mode)
|
|||
char buf2[BSIZE_SP];
|
||||
/* search in the path where the source (input) file has been found,
|
||||
but only if "name" is just a file name */
|
||||
if (!(index(name, DIR_TERM)) && !(index(name, DIR_TERM_LINUX)) && cp_getvar("sourcefile", CP_STRING, buf2)) {
|
||||
if (!strchr(name, DIR_TERM) && !strchr(name, DIR_TERM_LINUX) && cp_getvar("sourcefile", CP_STRING, buf2)) {
|
||||
/* If pathname is found, get path.
|
||||
(char *dirname(const char *name) might have been used here) */
|
||||
if (substring(DIR_PATHSEP, buf2) || substring(DIR_PATHSEP_LINUX, buf2)) {
|
||||
|
|
@ -821,7 +821,7 @@ inp_pathopen(char *name, char *mode)
|
|||
/* If this is an abs pathname, or there is no sourcepath var, just
|
||||
* do an fopen.
|
||||
*/
|
||||
if (index(name, DIR_TERM) || index(name, DIR_TERM_LINUX)
|
||||
if (strchr(name, DIR_TERM) || strchr(name, DIR_TERM_LINUX)
|
||||
|| !cp_getvar("sourcepath", CP_LIST, &v))
|
||||
return (fopen(name, mode));
|
||||
#else
|
||||
|
|
@ -830,7 +830,7 @@ inp_pathopen(char *name, char *mode)
|
|||
/* If this is an abs pathname, or there is no sourcepath var, just
|
||||
* do an fopen.
|
||||
*/
|
||||
if (index(name, DIR_TERM)
|
||||
if (strchr(name, DIR_TERM)
|
||||
|| !cp_getvar("sourcepath", CP_LIST, &v))
|
||||
return (fopen(name, mode));
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -672,7 +672,7 @@ PPlex(YYSTYPE *lvalp, struct PPltype *llocp, char **line)
|
|||
* name, and otherwise it isn't.
|
||||
* va, ']' too
|
||||
*/
|
||||
for (; *sbuf && !index(specials, *sbuf); sbuf++)
|
||||
for (; *sbuf && !strchr(specials, *sbuf); sbuf++)
|
||||
if (*sbuf == '@')
|
||||
atsign = 1;
|
||||
else if (!atsign && ( *sbuf == '[' || *sbuf == ']' ))
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ cp_ccom(wordlist *wlist, char *buf, bool esc)
|
|||
pmatches = ccfilec(buf);
|
||||
s =strrchr(buf, '/');
|
||||
i = (int) strlen(s ? s + 1 : buf);
|
||||
if ((*buf == '~') && !index(buf, '/'))
|
||||
if ((*buf == '~') && !strchr(buf, '/'))
|
||||
i--;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ cp_unixcom(wordlist *wl)
|
|||
wl_print(wl, stdout);
|
||||
printf(".\n");
|
||||
}
|
||||
if (index(name, '/'))
|
||||
if (strchr(name, '/'))
|
||||
return (tryexec(name, argv));
|
||||
i = hash(name);
|
||||
for (hh = hashtab[i]; hh; hh = hh->h_next) {
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ vec_get(const char *vec_name)
|
|||
|
||||
wd = word = copy(vec_name); /* Gets mangled below... */
|
||||
|
||||
if (index(word, '.')) {
|
||||
if (strchr(word, '.')) {
|
||||
/* Snag the plot... */
|
||||
for (i = 0, s = word; *s != '.'; i++, s++)
|
||||
buf[i] = *s;
|
||||
|
|
@ -854,7 +854,7 @@ vec_basename(struct dvec *v)
|
|||
char buf[BSIZE_SP], *t, *s;
|
||||
int i;
|
||||
|
||||
if (index(v->v_name, '.')) {
|
||||
if (strchr(v->v_name, '.')) {
|
||||
for (t = v->v_name, i = 0; *t; t++)
|
||||
buf[i++] = *t;
|
||||
buf[i] = '\0';
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd,
|
|||
WIN_ScreentoData(gr, xe, ye, &fxe, &fye);
|
||||
|
||||
strncpy(buf2, gr->plotname, sizeof(buf2));
|
||||
if ((t = index(buf2, ':')) != NULL) /* strchr */
|
||||
if ((t = strchr(buf2, ':')) != NULL)
|
||||
*t = 0;
|
||||
|
||||
if (!eq(plot_cur->pl_typename, buf2)) {
|
||||
|
|
|
|||
|
|
@ -192,14 +192,9 @@
|
|||
#define WaGauss
|
||||
#define RR_MAX RAND_MAX
|
||||
|
||||
#ifdef HAVE_INDEX
|
||||
#if !defined(HAVE_STRCHR) && defined(HAVE_INDEX)
|
||||
# define strchr index
|
||||
# define strrchr rindex
|
||||
#else /* va: no index, but strchr */
|
||||
# ifdef HAVE_STRCHR
|
||||
# define index strchr
|
||||
# define rindex strrchr
|
||||
# endif /* va: no index, but strchr */
|
||||
#endif
|
||||
|
||||
/* added for CYGWIN */
|
||||
|
|
|
|||
|
|
@ -1194,7 +1194,7 @@ int PTlex (YYSTYPE *lvalp, char **line)
|
|||
char *tmp;
|
||||
token = TOK_STR;
|
||||
for (s = sbuf; *s; s++)
|
||||
if (index(specials, *s))
|
||||
if (strchr(specials, *s))
|
||||
break;
|
||||
tmp = TMALLOC(char, s - sbuf + 1);
|
||||
strncpy(tmp, sbuf, (size_t) (s - sbuf));
|
||||
|
|
|
|||
Loading…
Reference in New Issue