mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-03 12:12:06 +00:00
Fix warning and add more tests for the foreach operators
This commit is contained in:
parent
5ee6961f0f
commit
d0044b9e95
@ -1977,7 +1977,7 @@ static int bin_imports(RCore *r, PJ *pj, int mode, int va, const char *name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RList *imports = r_bin_get_imports (r->bin);
|
||||
const RList *imports = r_bin_get_imports (r->bin);
|
||||
int cdsz = info? (info->bits == 64? 8: info->bits == 32? 4: info->bits == 16 ? 4: 0): 0;
|
||||
if (IS_MODE_JSON (mode)) {
|
||||
pj_a (pj);
|
||||
|
@ -4635,8 +4635,10 @@ R_API int r_core_cmd_foreach3(RCore *core, const char *cmd, char *each) { // "@@
|
||||
case 'c':
|
||||
if (glob) {
|
||||
char *arg = r_core_cmd_str (core, glob);
|
||||
foreach_pairs (core, cmd, arg);
|
||||
free (arg);
|
||||
if (arg) {
|
||||
foreach_pairs (core, cmd, arg);
|
||||
free (arg);
|
||||
}
|
||||
} else {
|
||||
eprintf ("Usage: @@@c:command # same as @@@=`command`\n");
|
||||
}
|
||||
|
@ -53,3 +53,35 @@ hello
|
||||
world
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=foreach iterator for other stuff
|
||||
FILE=bins/mach0/mac-ls
|
||||
CMDS=<<EOF
|
||||
?e hello
|
||||
?e=1@@@s~?
|
||||
?e=1@@@s~?
|
||||
?e=1@@@S~?
|
||||
?e=1@@@S~?
|
||||
?e=1@@@f~?
|
||||
?e=1@@@f~?
|
||||
?e=1@@@m~?
|
||||
?e=1@@@m~?
|
||||
?e=1@@@s~?
|
||||
?e=1@@@s~?
|
||||
?e world
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
hello
|
||||
116
|
||||
116
|
||||
16
|
||||
16
|
||||
342
|
||||
342
|
||||
3
|
||||
3
|
||||
116
|
||||
116
|
||||
world
|
||||
EOF
|
||||
RUN
|
||||
|
Loading…
x
Reference in New Issue
Block a user