Fix alloc size warning when building with recent GCC.

(cherry picked from commit 5cd0ba08b1)
This commit is contained in:
Martin Whitaker 2018-10-06 23:25:13 +01:00
parent ac2f5f0740
commit 869513a1ec
1 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2018 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -823,6 +823,7 @@ static void draw_udp_in_scope(ivl_net_logic_t lptr)
* (.resolv, etc.) can be built before we build the .udp call.
* This matches what is done for the other primitives.
*/
assert(ivl_logic_pins(lptr) > 0);
ninp = ivl_logic_pins(lptr) - 1;
input_strings = calloc(ninp, sizeof(char*));
for (pdx = 0 ; pdx < ninp ; pdx += 1) {
@ -885,7 +886,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
ivl_drive_t str1 = ivl_logic_drive1(lptr);
int level;
int ninp;
unsigned ninp;
const char **input_strings;
switch (ivl_logic_type(lptr)) {
@ -1018,8 +1019,8 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
/* Get all the input label that I will use for parameters to
the functor that I create later. */
assert(ivl_logic_pins(lptr) > 0);
ninp = ivl_logic_pins(lptr) - 1;
assert(ninp >= 0);
input_strings = calloc(ninp, sizeof(char*));
for (pdx = 0 ; pdx < (unsigned)ninp ; pdx += 1)
input_strings[pdx] = draw_net_input(ivl_logic_pin(lptr, pdx+1));