From 13d8a7f515a78d12ae3ac7fbc3879b1363fa37d9 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 7 Mar 2020 19:46:54 +0100 Subject: [PATCH] correct the return values --- src/misc/string.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/misc/string.c b/src/misc/string.c index b498308f2..afbcd80c9 100644 --- a/src/misc/string.c +++ b/src/misc/string.c @@ -755,8 +755,8 @@ gettok_node(char **s) /*-------------------------------------------------------------------------* * get_l_paren iterates the pointer forward in a string until it hits * the position after the next left paren "(". It returns 0 if it found a left - * paren, and 1 if no left paren is found. It is called from 'translate' - * (subckt.c). + * paren, 1 if no left paren is found, -1 if left paren is the last character. + * It is called from 'translate' (subckt.c). *-------------------------------------------------------------------------*/ int @@ -770,15 +770,18 @@ get_l_paren(char **s) (*s)++; - return **s == '\0'; + if (**s == '\0') + return -1; + + return 0; } /*-------------------------------------------------------------------------* * get_r_paren iterates the pointer forward in a string until it hits * the position after the next right paren ")". It returns 0 if it found a right - * paren, and 1 if no right paren is found. It is called from 'translate' - * (subckt.c). + * paren, 1 if no right paren is found, and -1 if right paren is te last + * character. It is called from 'translate' (subckt.c). *-------------------------------------------------------------------------*/ int @@ -792,7 +795,10 @@ get_r_paren(char **s) (*s)++; - return **s == '\0'; + if (**s == '\0') + return -1; + + return 0; } /*-------------------------------------------------------------------------*