mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 03:11:28 +00:00
add r_stack_peek to the stack api
This commit is contained in:
parent
991a1b8dd9
commit
e4652c0319
@ -17,4 +17,5 @@ R_API RStack *r_stack_newf(ut32 n, RStackFree f);
|
||||
R_API int r_stack_push(RStack *s, void *el);
|
||||
R_API void *r_stack_pop(RStack *s);
|
||||
R_API unsigned int r_stack_size(RStack *s);
|
||||
R_API void *r_stack_peek(RStack *s);
|
||||
#endif // R_STACK_H
|
||||
|
@ -71,3 +71,12 @@ R_API bool r_stack_is_empty(RStack *s) {
|
||||
R_API unsigned int r_stack_size(RStack *s) {
|
||||
return (unsigned int)(s->top + 1);
|
||||
}
|
||||
|
||||
R_API void *r_stack_peek(RStack *s) {
|
||||
void *res;
|
||||
if (s->top != -1) {
|
||||
res = s->elems[s->top];
|
||||
return res;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user