summaryrefslogtreecommitdiffstats
path: root/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c
diff options
context:
space:
mode:
Diffstat (limited to 'rtemstoolkit/elftoolchain/libelf/libelf_allocate.c')
-rw-r--r--rtemstoolkit/elftoolchain/libelf/libelf_allocate.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c b/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c
index a753e8e..0a74fac 100644
--- a/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c
+++ b/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c
@@ -28,10 +28,6 @@
* Internal APIs
*/
-#include <sys/cdefs.h>
-
-#include <sys/errno.h>
-
#include <assert.h>
#include <errno.h>
#include <libelf.h>
@@ -40,7 +36,7 @@
#include "_libelf.h"
-LIBELF_VCSID("$Id: libelf_allocate.c 1341 2011-01-01 04:28:29Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_allocate.c 3174 2015-03-27 17:13:41Z emaste $");
Elf *
_libelf_allocate_elf(void)
@@ -135,12 +131,12 @@ _libelf_release_elf(Elf *e)
return (NULL);
}
-Elf_Data *
+struct _Libelf_Data *
_libelf_allocate_data(Elf_Scn *s)
{
- Elf_Data *d;
+ struct _Libelf_Data *d;
- if ((d = calloc((size_t) 1, sizeof(Elf_Data))) == NULL) {
+ if ((d = calloc((size_t) 1, sizeof(*d))) == NULL) {
LIBELF_SET_ERROR(RESOURCE, 0);
return (NULL);
}
@@ -150,12 +146,12 @@ _libelf_allocate_data(Elf_Scn *s)
return (d);
}
-Elf_Data *
-_libelf_release_data(Elf_Data *d)
+struct _Libelf_Data *
+_libelf_release_data(struct _Libelf_Data *d)
{
if (d->d_flags & LIBELF_F_DATA_MALLOCED)
- free(d->d_buf);
+ free(d->d_data.d_buf);
free(d);
@@ -187,18 +183,18 @@ Elf_Scn *
_libelf_release_scn(Elf_Scn *s)
{
Elf *e;
- Elf_Data *d, *td;
+ struct _Libelf_Data *d, *td;
assert(s != NULL);
STAILQ_FOREACH_SAFE(d, &s->s_data, d_next, td) {
- STAILQ_REMOVE(&s->s_data, d, _Elf_Data, d_next);
+ STAILQ_REMOVE(&s->s_data, d, _Libelf_Data, d_next);
d = _libelf_release_data(d);
}
STAILQ_FOREACH_SAFE(d, &s->s_rawdata, d_next, td) {
assert((d->d_flags & LIBELF_F_DATA_MALLOCED) == 0);
- STAILQ_REMOVE(&s->s_rawdata, d, _Elf_Data, d_next);
+ STAILQ_REMOVE(&s->s_rawdata, d, _Libelf_Data, d_next);
d = _libelf_release_data(d);
}