Commit Graph

84 Commits

Author SHA1 Message Date
Holger Vogt e9fcb9b332 Prevent crash in gettok() and similar functions by checking for NULL
input. Return NULL instead.
2022-09-01 16:57:54 +02:00
Holger Vogt 86dedbd1f5 Add a new function char* gettok_np(char** s)
which finds a token, while scanning over (), like
they were white spaces. It also proceeds with s while
still finding (), (which gettok_noparens does not do).
2022-07-06 18:43:48 +02:00
Holger Vogt 074a2a6f11 Fix bug 581, reported by Adam Denton 2022-05-02 20:32:21 +02:00
Holger Vogt 7703c2d370 Add a function itoa10 and use it
instead of non-standard itoa.
2022-04-25 13:35:23 +02:00
Holger Vogt 736d42a5b0 remove unused 2021-03-14 15:32:39 +01:00
Holger Vogt 5747982ae8 Re-enable devices like E2 1 0 (2,3) 1
Add a new function nexttok_noparens(const char *s) which
skips tokens. Characters , ( and ) are treated like spaces.
2021-01-28 17:06:02 +01:00
Holger Vogt 4a8065c3ee replace strncpy by memcpy to prevent valgrind error message
on uninitialized string.
2021-01-05 17:21:23 +01:00
Holger Vogt 238f8d393a Suppress some compiler warnings 2020-12-22 17:56:19 +01:00
Holger Vogt ced7604fc4 fix comment 2020-12-22 17:56:18 +01:00
Jim Monte 1d62ae2d97 type casts 2020-04-27 10:22:40 +02:00
Holger Vogt 02cf88c119 correct the return values 2020-03-15 08:51:18 +01:00
Holger Vogt d967e18632 compatibility to old vsnprintf() in MINGW is no longer needed.
Compiling with -D__USE_MINGW_ANSI_STDIO=1 enables C99 compatibility.
2020-03-15 08:51:18 +01:00
Holger Vogt 249304a06f Instantiations of string and dstring functions as inline
This will remove the redundant-decls warning
2020-03-15 08:51:17 +01:00
Holger Vogt bcfdc806a5 work around a bug in MINGW
Reported in
https://github.com/msys2/MINGW-packages/issues/6254
2020-03-15 08:51:17 +01:00
Jim Monte 72801b1ab1 Fixed buffer resizing, made string utilities more modular, and added several new utilities, some which do not require a null termination, potentially avoiding the need to copy a string. Also some substring utilities using the Rabin-Karp algorithm were added. 2020-03-15 08:50:52 +01:00
Jim Monte 81fa829b7d Fixed potential infinite loop (until memory is exhausted) and added several utility functions for processing strings. 2020-03-15 08:50:52 +01:00
Holger Vogt c50dfa2be8 prevent crash if function is called with NULL argument 2019-08-13 23:31:01 +02:00
Jim Monte e92e2c7362 [PATCH #62] Fixed buffer overrun. Reworked to not use dstring for more
efficient parsing.
2019-08-13 23:30:31 +02:00
Jim Monte b66412f517 [PATCH] Changed prototypes of some functions having parameters that
should not be changed to const and added assorted comments. Also two very
 minor efficiency improvements.
2019-08-13 23:20:21 +02:00
Holger Vogt 61039c2736 add a new function gettok_model to consider {...} expressions
in VDMOS .model statements
2019-08-13 23:17:14 +02:00
rlar 900bed550d string.c, #6/6, use skip_ws() and skip_back_ws() 2017-04-09 15:35:44 +02:00
rlar 0da47c644b string.c, #5/6, cleanup 2017-04-09 15:35:41 +02:00
rlar 5b23b54769 string.c, #4/6, cleanup token fetching 2017-04-09 15:35:38 +02:00
rlar c6a3438408 string.c, #3/6, cleanup 'return' 2017-04-09 15:35:35 +02:00
rlar ed13e8a15a string.c, #2/7, drop 'register' 2017-04-09 15:35:32 +02:00
rlar d48bec757c string.c, #1/6, whitespace 2017-04-09 15:35:29 +02:00
rlar dc6e1cb064 use strchr() instead of strstr() 2017-03-19 20:24:49 +01:00
rlar 7a42510cc0 const'ify some 'skip'ing functions 2017-03-19 20:12:25 +01:00
rlar 45ad60b738 rename gettok_nc() --> nexttok(), and functionalize it 2017-03-19 20:11:01 +01:00
h_vogt 6a0a6071a0 gettok_nc(&line): like gettok(), move pointer beyond next token in line, but without returning a string, without TMALLOC. Replaces constructs like tfree(gettok(&line)). 2016-10-15 15:06:20 +02:00
h_vogt 33b11f9598 comments improved 2016-08-15 11:26:55 +02:00
rlar d298d5cc2f use memset() instead of deprecated bzero() 2016-07-30 20:58:33 +02:00
rlar 141ed61ec8 use memcpy() instead of deprecated bcopy() 2016-07-30 20:58:19 +02:00
rlar 5e04924890 cleanup `skip_ws()' usage 2016-03-22 15:26:11 +01:00
rlar b1d8b99018 skip-ws, #6/6, rename to match inpcom.c 2016-03-22 15:26:10 +01:00
rlar 22875d056b skip-ws, #5/6, use functional style 2016-03-22 15:26:09 +01:00
rlar a86f2068c8 skip-ws, #3/6, use TEMPORARY macros, obj-invariant 2016-03-22 15:26:06 +01:00
rlar 6d1171ad6f skip-ws, #2/6, introduce "ngspice/stringskip.h"
with some temporary macros to skip whitespace
2016-03-22 15:26:05 +01:00
rlar 726d0be34c use char variants of the <ctype.h> toxxxx() family 2016-03-09 20:24:36 +01:00
rlar 71a7c3459b use char variants of the <ctype.h> isxxxx() family 2016-03-09 20:24:36 +01:00
rlar d37f18d777 misc/string.c, sprinkle some const'ness 2015-12-22 16:47:42 +01:00
rlar 192eeadb0b remove crufty comments which where used to support broken text editors 2015-09-24 18:23:54 +02:00
rlar 7b0275ebf7 string.c, swallow "warning: value computed is not used" 2015-01-04 20:31:45 +01:00
rlar 7524ad2ee6 src/misc/string.c, rewrite using `copy_substring()' 2014-12-01 20:18:59 +01:00
rlar f5d05af51d inpgmod.c, INPgetModBin(), use model_name_match() 2014-08-09 18:17:51 +02:00
rlar b663731379 rewrite model_bin_match(), rename --> model_name_match() 2014-08-09 18:17:34 +02:00
rlar 7f7453a227 inp_do_macro_param_replace(), fix several bugs concerning .func processing 2014-07-08 18:19:26 +02:00
rlar 80dd41451f introduce tvprintf() 2014-04-12 21:01:36 +02:00
rlar a4780f8e34 string.c, introduce tprintf() 2014-04-05 18:44:27 +02:00
rlar a94170d2ab gettok_node(), use copy_substring() 2013-12-31 16:25:50 +01:00