p4lang / behavioral-model

The reference P4 software switch
Apache License 2.0
532 stars 327 forks source link

bf_lpm_trie: fix gcc warning #1181

Closed rst0git closed 1 year ago

rst0git commented 1 year ago

This pull request fixes the following compiler warning:

../src/bf_lpm_trie/bf_lpm_trie.c:167:56: warning: 'idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  167 |   memmove(&branches->branches[idx], &branches->branches[idx + 1], size);
      |                                                        ^
../src/bf_lpm_trie/bf_lpm_trie.c:152:7: note: 'idx' was declared here
  152 |   int idx;
      |       ^
../src/bf_lpm_trie/bf_lpm_trie.c:267:56: warning: 'idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  267 |   memmove(&prefixes->prefixes[idx], &prefixes->prefixes[idx + 1], size);
      |                                                        ^
../src/bf_lpm_trie/bf_lpm_trie.c:251:7: note: 'idx' was declared here