embryo - embryo_cc - silence some new gcc warnings

lets us focus on real errors in warnings if we have silence
This commit is contained in:
Carsten Haitzler 2021-05-26 04:33:54 +01:00
parent 11e4cad03e
commit f4ff12406c
3 changed files with 16 additions and 5 deletions

View File

@ -3032,11 +3032,22 @@ insert_constval(constvalue * prev, constvalue * next, char *name,
cell val, short idx)
{
constvalue *cur;
char *s, *d;
if (!(cur = (constvalue *)malloc(sizeof(constvalue))))
if (!(cur = calloc(1, sizeof(constvalue))))
error(103); /* insufficient memory (fatal error) */
memset(cur, 0, sizeof(constvalue));
strncpy(cur->name, name, sizeof(cur->name) - 1);
// strncpy(cur->name, name, sizeof(cur->name) - 1);
// I'm forced to do the below as new gcc warnings I can't seem to shut up
// complain so implement in full to get some silence.
for (d = cur->name, s = name; ; )
{
*d++ = *s;
if ((size_t)(s - name) < (size_t)(sizeof(cur->name) - 1))
{
if (*s) s++;
}
else break;
}
cur->name[sizeof(cur->name) - 1] = 0;
cur->value = val;
cur->index = idx;

View File

@ -26,7 +26,7 @@ int strexpand(char *dest, unsigned char *source, int maxlen,
#define SCPACK_TABLE errstr_table
/*-*SCPACK start of pair table, do not change or remove this line */
unsigned char errstr_table[][2] = {
unsigned char errstr_table[128][2] = {
{101, 32}, {116, 32}, {111, 110}, {105, 110}, {97, 114}, {100, 32}, {105,
130},
{101, 114}, {101, 110}, {115, 32}, {97, 108}, {97, 116}, {117, 110}, {115,

View File

@ -29,7 +29,7 @@ int strexpand(char *dest, unsigned char *source, int maxlen,
#define SCPACK_TABLE sequences_table
/*-*SCPACK start of pair table, do not change or remove this line */
unsigned char sequences_table[][2] = {
unsigned char sequences_table[128][2] = {
{32, 37}, {114, 105}, {112, 129}, {46, 130}, {49, 33}, {128, 132}, {97, 100},
{46, 97}, {135, 108}, {136, 116}, {111, 134}, {108, 138}, {50, 33}, {115,
104},