Skip to content

Commit

Permalink
Merge pull request #130 from niklaut/fix/cpp_guards
Browse files Browse the repository at this point in the history
Add missing C++ include guards
  • Loading branch information
mubes authored Nov 5, 2023
2 parents 1ef7a09 + 5152b38 commit cbf5431
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
9 changes: 8 additions & 1 deletion Inc/loadelf.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <stdbool.h>
#include <capstone/capstone.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef unsigned long int symbolMemaddr;
typedef unsigned char *symbolMemptr;

Expand Down Expand Up @@ -121,11 +125,14 @@ char *symbolDisassembleLine( struct symbol *p, enum instructionClass *ic, symbol
void symbolDelete( struct symbol *p );

/* Collect symbol set with specified components */
struct symbol *symbolAquire( char *filename, bool loadlines, bool loadmem, bool loadsource );
struct symbol *symbolAcquire( char *filename, bool loadlines, bool loadmem, bool loadsource );

/* Check if current symbols are valid */
bool symbolSetValid( struct symbol *p );

// ====================================================================================================

#ifdef __cplusplus
}
#endif
#endif
7 changes: 7 additions & 0 deletions Inc/readsource.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#ifndef _READSOURCE_H_
#define _READSOURCE_H_

#ifdef __cplusplus
extern "C" {
#endif

// ====================================================================================================

char *readsourcefile( char *path, size_t *l );

// ====================================================================================================

#ifdef __cplusplus
}
#endif
#endif

6 changes: 3 additions & 3 deletions Src/loadelf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ bool symbolSetValid( struct symbol *p )

// ====================================================================================================

struct symbol *symbolAquire( char *filename, bool loadlines, bool loadmem, bool loadsource )
struct symbol *symbolAcquire( char *filename, bool loadlines, bool loadmem, bool loadsource )

/* Collect symbol set with specified components */

Expand All @@ -1128,7 +1128,7 @@ struct symbol *symbolAquire( char *filename, bool loadlines, bool loadmem, bool
}

/* Load the functions and source code line mappings if requested */
if ( !_readLines( p ) )
if ( loadlines && !_readLines( p ) )
{
symbolDelete( p );
return NULL;
Expand Down Expand Up @@ -1237,7 +1237,7 @@ void main( int argc, char *argv[] )

{
enum instructionClass ic;
struct symbol *p = symbolAquire( argv[1], true, true, true );
struct symbol *p = symbolAcquire( argv[1], true, true, true );

if ( !p )
{
Expand Down
4 changes: 2 additions & 2 deletions Src/orbmortem.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ static bool _dumpBuffer( struct RunTime *r )
{
symbolDelete( r->s );

if ( !( r->s = symbolAquire( r->options->elffile, true, true, true ) ) )
if ( !( r->s = symbolAcquire( r->options->elffile, true, true, true ) ) )
{
genericsReport( V_ERROR, "Elf file or symbols in it not found" EOL );
return false;
Expand Down Expand Up @@ -1270,7 +1270,7 @@ int main( int argc, char *argv[] )
}

/* Check we've got _some_ symbols to start from */
_r.s = symbolAquire( _r.options->elffile, true, true, true );
_r.s = symbolAcquire( _r.options->elffile, true, true, true );

if ( !_r.s )
{
Expand Down

0 comments on commit cbf5431

Please sign in to comment.