mirror of
https://github.com/lcn2/calc.git
synced 2025-08-22 01:23:28 +03:00
checkpoint on string realloc bug fix attempt
In preparation to fix issue #47, we: Fix a minor typo in `Makefile.config`. Move `stringindex(char *format, char *test)` from `str.c` into `codegen.c` as static function. Expand `STR_TABLECHUNK` from `1<<10` to `1<<16`. Identify with an XXX comment, a problematic `realloc()` call in the `addstr(STRINGHEAD *hp, char *str)` function of `str.c`. Move the `charstr(int ch)` in `str.c` above the only function that uses it, `addliteral(char *str)`, and make it a static function. Improved comments about return values for `str.c` functions that work on STRINGHEAD pointers.
This commit is contained in:
4
str.h
4
str.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* str - string list routines
|
||||
*
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014,2025 David I. Bell
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -59,9 +59,7 @@ E_FUNC void initstr(STRINGHEAD *hp);
|
||||
E_FUNC char *addstr(STRINGHEAD *hp, char *str);
|
||||
E_FUNC char *namestr(STRINGHEAD *hp, long n);
|
||||
E_FUNC int findstr(STRINGHEAD *hp, char *str);
|
||||
E_FUNC char *charstr(int ch);
|
||||
E_FUNC char *addliteral(char *str);
|
||||
E_FUNC long stringindex(char *str1, char *str2);
|
||||
E_FUNC STRING *stralloc(void);
|
||||
E_FUNC long addstring(char *str, size_t len);
|
||||
E_FUNC STRING *charstring(int ch);
|
||||
|
Reference in New Issue
Block a user