diff options
author | kaiw <kaiw@FreeBSD.org> | 2010-07-21 12:14:50 +0000 |
---|---|---|
committer | kaiw <kaiw@FreeBSD.org> | 2010-07-21 12:14:50 +0000 |
commit | 82c6a0d5cc52ec43523cf92cde5b8f83a24a9dba (patch) | |
tree | c51322098a7ff392aeb36ee7f884e6c98b223c94 /lib/libelf/elf_shnum.c | |
parent | 1b382f295a0ad2611d29740a5e9cd23ef4a767c1 (diff) | |
download | FreeBSD-src-82c6a0d5cc52ec43523cf92cde5b8f83a24a9dba.zip FreeBSD-src-82c6a0d5cc52ec43523cf92cde5b8f83a24a9dba.tar.gz |
* Deprecate `elf_getshnum()`, `elf_getphnum()` and `elf_getshstrndx()` in
favour of `elf_getshdrnum()`, `elf_getphdrnum()` and `elf_getshdrstrndx()`
respectively.
* Add new manual pages for `elf_getshdrstrndx()`, `elf_getphdrnum()` and
`elf_getshdrnum()`.
* Add a deprecation warning for `elf_getshstrndx()`, `elf_getphnum()` and
`elf_getshnum()`.
Obtained from: elftoolchain
MFC after: 1 month
Diffstat (limited to 'lib/libelf/elf_shnum.c')
-rw-r--r-- | lib/libelf/elf_shnum.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/libelf/elf_shnum.c b/lib/libelf/elf_shnum.c index d22a1fc..50cd0f5 100644 --- a/lib/libelf/elf_shnum.c +++ b/lib/libelf/elf_shnum.c @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getshnum(Elf *e, size_t *shnum) +static int +_libelf_getshdrnum(Elf *e, size_t *shnum) { void *eh; int ec; @@ -41,13 +41,26 @@ elf_getshnum(Elf *e, size_t *shnum) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *shnum = e->e_u.e_elf.e_nscn; - return (1); + return (0); +} + +int +elf_getshdrnum(Elf *e, size_t *shnum) +{ + return (_libelf_getshdrnum(e, shnum)); +} + +/* Deprecated API. */ +int +elf_getshnum(Elf *e, size_t *shnum) +{ + return (_libelf_getshdrnum(e, shnum) >= 0); } |