Skip to content

Commit

Permalink
GH a2o#119: Create patches for sets of #define statements that add …
Browse files Browse the repository at this point in the history
…`snoopy_` prefix to all external library's symbols
  • Loading branch information
bostjan committed Nov 26, 2020
1 parent f54f260 commit e2ead02
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/inih/patches/0002-prefix-function-names.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- src/ini.h.ORIG 2020-11-26 03:37:52.533640594 +0100
+++ src/ini.h 2020-11-26 03:38:43.553738846 +0100
@@ -10,6 +10,13 @@
#ifndef __INI_H__
#define __INI_H__

+/* START For Snoopy - redefine function names, to avoid symbol name collisions */
+#define ini_parse snoopy_ini_parse
+#define ini_parse_file snoopy_ini_parse_file
+#define ini_parse_stream snoopy_ini_parse_stream
+#define ini_parse_string snoopy_ini_parse_string
+/* END For Snoopy */
+
/* Make this header file easier to include in C++ code */
#ifdef __cplusplus
extern "C" {
7 changes: 7 additions & 0 deletions lib/inih/src/ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ home page for more info:
#ifndef __INI_H__
#define __INI_H__

/* START For Snoopy - redefine function names, to avoid symbol name collisions */
#define ini_parse snoopy_ini_parse
#define ini_parse_file snoopy_ini_parse_file
#define ini_parse_stream snoopy_ini_parse_stream
#define ini_parse_string snoopy_ini_parse_string
/* END For Snoopy */

/* Make this header file easier to include in C++ code */
#ifdef __cplusplus
extern "C" {
Expand Down
21 changes: 21 additions & 0 deletions lib/liblcthw/patches/0004-prefix-function-names.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- src/list.h.ORIG 2020-11-26 03:40:34.773954562 +0100
+++ src/list.h 2020-11-26 03:41:02.702009021 +0100
@@ -1,6 +1,18 @@
#ifndef lcthw_List_h
#define lcthw_List_h

+/* START For Snoopy - redefine function names, to avoid symbol name collisions */
+#define List_clear snoopy_List_clear
+#define List_clear_destroy snoopy_List_clear_destroy
+#define List_create snoopy_List_create
+#define List_destroy snoopy_List_destroy
+#define List_pop snoopy_List_pop
+#define List_push snoopy_List_push
+#define List_remove snoopy_List_remove
+#define List_shift snoopy_List_shift
+#define List_unshift snoopy_List_unshift
+/* END For Snoopy */
+
#include <stdlib.h>

struct ListNode;
12 changes: 12 additions & 0 deletions lib/liblcthw/src/list.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#ifndef lcthw_List_h
#define lcthw_List_h

/* START For Snoopy - redefine function names, to avoid symbol name collisions */
#define List_clear snoopy_List_clear
#define List_clear_destroy snoopy_List_clear_destroy
#define List_create snoopy_List_create
#define List_destroy snoopy_List_destroy
#define List_pop snoopy_List_pop
#define List_push snoopy_List_push
#define List_remove snoopy_List_remove
#define List_shift snoopy_List_shift
#define List_unshift snoopy_List_unshift
/* END For Snoopy */

#include <stdlib.h>

struct ListNode;
Expand Down

0 comments on commit e2ead02

Please sign in to comment.