Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at gencode.c:197

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dfw_append_function

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dfilter/gencode.c)expand/collapse
Show more  
 172  dfw_append_function(dfwork_t *dfw, stnode_t *node, dfvm_value_t **p_jmp)
 173  {
 174      GSList *params;
 175      int i, num_params, reg;
 176      dfvm_value_t **jmps;
 177          dfvm_insn_t     *insn;
 178          dfvm_value_t    *val1, *val2, *val;
 179   
 180      params = sttype_function_params(node);
 181      num_params = g_slist_length(params);
 182   
 183      /* Array to hold the instructions that need to jump to
 184       * an instruction if they fail. */
 185      jmps = g_malloc(num_params * sizeof(dfvm_value_t*));
 186   
 187      /* Create the new DFVM instruction */
 188      insn = dfvm_insn_new(CALL_FUNCTION);
 189   
 190      val1 = dfvm_value_new(FUNCTION_DEF);
 191      val1->value.funcdef = sttype_function_funcdef(node);
 192      insn->arg1 = val1;
 193          val2 = dfvm_value_new(REGISTER);
 194          val2->value.numeric = dfw->next_register++;
 195      insn->arg2 = val2;
 196      insn->arg3 = NULL;
 197      insn->arg4 = NULL;
 198   
 199      i = 0;
 200      while (params) {
 201          jmps[i] = NULL;
 202          reg = gen_entity(dfw, params->data, &jmps[i]);
 203   
 204          val = dfvm_value_new(REGISTER);
 205          val->value.numeric = reg;
 206   
 207          switch(i) {
 208              case 0:
 209                  insn->arg3 = val;
 210                  break;
 211              case 1:
 212                  insn->arg4 = val;
 213                  break;
 214              default:
 215                  g_assert_not_reached();
 216          }
 217   
 218          params = params->next;
 219          i++;
 220      }
 221   
 222          dfw_append_insn(dfw, insn);
 223   
 224      /* If any of our parameters failed, send them to 
 225       * our own failure instruction. This *has* to be done 
 226       * after we caled dfw_append_insn above so that 
 227       * we know what the next DFVM insruction is, via 
 228       * dfw->next_insn_id */
 229      for (i = 0; i < num_params; i++) {
 230          if (jmps[i]) {
 231              jmps[i]->value.numeric = dfw->next_insn_id;
 232          }
 233      }
 234   
 235      /* We need another instruction to jump to another exit 
 236       * place, if the call() of our function failed for some reaosn */
 237      insn = dfvm_insn_new(IF_FALSE_GOTO);
 238      g_assert(p_jmp);
 239      *p_jmp = dfvm_value_new(INSN_NUMBER);
 240      insn->arg1 = *p_jmp;
 241      dfw_append_insn(dfw, insn);
 242   
 243      g_free(jmps);
 244   
 245      return val2->value.numeric;
 246  }
Show more  




Change Warning 1162.29721 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: