Rizin
unix-like reverse engineering framework and cli tools
switch.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2014-2019 pancake <pancake@nopcode.org>
2 // SPDX-FileCopyrightText: 2014-2019 dso <dso@rice.edu>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #include <rz_analysis.h>
6 
9  if (swop) {
10  swop->cases = rz_list_new();
11  if (!swop->cases) {
12  free(swop);
13  return NULL;
14  }
15  swop->cases->free = (void *)free;
16  swop->min_val = swop->def_val = swop->max_val = 0;
17  }
18  return swop;
19 }
20 
23  if (swop) {
24  swop->addr = addr;
25  swop->min_val = min_val;
26  swop->def_val = def_val;
27  swop->max_val = max_val;
28  }
29  return swop;
30 }
31 
34  if (c) {
35  c->addr = addr;
36  c->value = val;
37  c->jump = jump;
38  }
39  return c;
40 }
41 
43  if (swop) {
44  rz_list_free(swop->cases);
45  free(swop);
46  }
47 }
48 
52  if (caseop) {
53  rz_list_append(swop->cases, caseop);
54  }
55  return caseop;
56 }
ut16 val
Definition: armass64_const.h:6
int jump(int a, int b)
Definition: bcj_test.c:35
static int value
Definition: cmd_api.c:93
#define RZ_API
#define NULL
Definition: cris-opc.c:27
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
Definition: list.c:235
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define RZ_NEW0(x)
Definition: rz_types.h:284
#define UT64_MAX
Definition: rz_types_base.h:86
#define c(i)
Definition: sha256.c:43
RzListFree free
Definition: rz_list.h:21
static RzAnalysisSwitchOp * __switch_op_new(void)
Definition: switch.c:7
RZ_API RzAnalysisCaseOp * rz_analysis_case_op_new(ut64 addr, ut64 val, ut64 jump)
Definition: switch.c:32
RZ_API void rz_analysis_switch_op_free(RzAnalysisSwitchOp *swop)
Definition: switch.c:42
RZ_API RzAnalysisSwitchOp * rz_analysis_switch_op_new(ut64 addr, ut64 min_val, ut64 max_val, ut64 def_val)
Definition: switch.c:21
RZ_API RzAnalysisCaseOp * rz_analysis_switch_op_add_case(RzAnalysisSwitchOp *swop, ut64 addr, ut64 value, ut64 jump)
Definition: switch.c:49
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58