6 char *getline_wrapped(FILE *file
, unsigned int *linenum
);
8 void filename2modname(char *modname
, const char *filename
);
9 char *underscores(char *string
);
11 const char *next_string(const char *string
, unsigned long *secsize
);
14 * Change endianness of x if conv is true.
16 #define END(x, conv) \
19 if (conv) __swap_bytes(&(x), &(__x), sizeof(__x)); \
24 static inline void __swap_bytes(const void *src
, void *dest
, unsigned int size
)
27 for (i
= 0; i
< size
; i
++)
28 ((unsigned char*)dest
)[i
] = ((unsigned char*)src
)[size
- i
-1];
31 int native_endianness(void);
33 int elf_ident(void *file
, unsigned long fsize
, int *conv
);
34 void *get_section(void *file
, unsigned long filesize
,
35 const char *secname
, unsigned long *secsize
);
36 void *get_section32(void *file
, unsigned long filesize
,
37 const char *secname
, unsigned long *secsize
, int conv
);
38 void *get_section64(void *file
, unsigned long filesize
,
39 const char *secname
, unsigned long *secsize
, int conv
);
41 #define streq(a,b) (strcmp((a),(b)) == 0)
42 #define strstarts(a,start) (strncmp((a),(start), strlen(start)) == 0)
43 #define my_basename(path) ((strrchr((path), '/') ?: (path) - 1) + 1)