Changeset 120067


Ignore:
Timestamp:
May 14, 2014, 10:18:53 PM (6 years ago)
Author:
cal@…
Message:

base: machista1.0: Fix warnings on Linux, define feature test macros

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/machista1.0/libmachista.c

    r116109 r120067  
    3131 */
    3232
     33#ifdef HAVE_CONFIG_H
    3334#include <config.h>
     35#endif
     36
     37/* required for asprintf(3) on OS X */
     38#define _DARWIN_C_SOURCE
     39/* required for asprintf(3) on Linux */
     40#define _GNU_SOURCE
    3441
    3542#include <stdbool.h>
     
    110117}
    111118
     119#ifdef __MACH__
    112120const char *macho_get_arch_name (cpu_type_t cputype) {
    113 #ifdef __MACH__
    114121    const NXArchInfo *archInfo = NXGetArchInfoFromCpuType(cputype, CPU_SUBTYPE_MULTIPLE);       
    115122    if (!archInfo) {
     
    118125    return archInfo->name;
    119126#else
     127const char *macho_get_arch_name (cpu_type_t cputype UNUSED) {
    120128    return NULL;
    121129#endif
     
    240248
    241249/* Parse a Mach-O header */
     250#ifdef __MACH__
    242251static int parse_macho (macho_t *mt, macho_input_t *input) {
    243 #ifdef __MACH__
    244252    /* Read the file type. */
    245253    const uint32_t *magic = macho_read(input, input->data, sizeof(uint32_t));
     
    438446
    439447    return MACHO_SUCCESS;
    440 #else
    441     return 0;
    442 #endif
    443 }
     448}
     449#endif
    444450
    445451/* Parse a (possible Mach-O) file. For a more detailed description, see the header */
     452#ifdef __MACH__
    446453int macho_parse_file(macho_handle_t *handle, const char *filepath, const macho_t **res) {
    447 #ifdef __MACH__
    448454    int fd;
    449455    struct stat st;
     
    506512    return ret;
    507513#else
     514int macho_parse_file(macho_handle_t *handle UNUSED, const char *filepath UNUSED, const macho_t **res UNUSED) {
    508515    return 0;
    509516#endif
Note: See TracChangeset for help on using the changeset viewer.