Revert "libbpf: Add NULL checks to bpf_object__{prev_map,next_map}"

This reverts commit 532ee6e841.
This commit is contained in:
Ksawlii 2024-11-24 00:23:40 +01:00
parent 8cac0e6819
commit c6e34888b5

View file

@ -9005,7 +9005,7 @@ __bpf_map__iter(const struct bpf_map *m, const struct bpf_object *obj, int i)
struct bpf_map * struct bpf_map *
bpf_map__next(const struct bpf_map *prev, const struct bpf_object *obj) bpf_map__next(const struct bpf_map *prev, const struct bpf_object *obj)
{ {
if (prev == NULL && obj != NULL) if (prev == NULL)
return obj->maps; return obj->maps;
return __bpf_map__iter(prev, obj, 1); return __bpf_map__iter(prev, obj, 1);
@ -9014,7 +9014,7 @@ bpf_map__next(const struct bpf_map *prev, const struct bpf_object *obj)
struct bpf_map * struct bpf_map *
bpf_map__prev(const struct bpf_map *next, const struct bpf_object *obj) bpf_map__prev(const struct bpf_map *next, const struct bpf_object *obj)
{ {
if (next == NULL && obj != NULL) { if (next == NULL) {
if (!obj->nr_maps) if (!obj->nr_maps)
return NULL; return NULL;
return obj->maps + obj->nr_maps - 1; return obj->maps + obj->nr_maps - 1;