Skip to content
This repository

HACK: do not expose libyajl API #93

Merged
merged 1 commit into from over 2 years ago

2 participants

Sergey Avseyev Brian Lopez
Sergey Avseyev

This patch hides libyajl API and allow other gems that use the same API calls load after yajl-ruby. This patch is related to issue #92

Brian Lopez
Owner

I thought about doing this in the past, how portable is that "private" directive (regarding supported ruby platforms)

Sergey Avseyev

I think it is GCC specific

Brian Lopez
Owner

I'll give this a try as soon as I can, thanks!

Brian Lopez brianmario merged commit 026698b into from December 14, 2011
Brian Lopez brianmario closed this December 14, 2011
Brian Lopez
Owner

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Dec 13, 2011
Sergey Avseyev HACK: do not expose libyajl API fa3c9a6
This page is out of date. Refresh to see the latest.
2  ext/yajl/api/yajl_common.h
@@ -50,7 +50,7 @@ extern "C" {
50 50
 #  endif
51 51
 #else
52 52
 #  if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
53  
-#    define YAJL_API __attribute__ ((visibility("default")))
  53
+#    define YAJL_API __attribute__ ((visibility("hidden")))
54 54
 #  else
55 55
 #    define YAJL_API
56 56
 #  endif
2  ext/yajl/api/yajl_parse.h
@@ -133,7 +133,7 @@ extern "C" {
133 133
                                     void * ctx);
134 134
     
135 135
     /** allow resetting of the lexer without the need to realloc a new parser */
136  
-    void yajl_reset_parser(yajl_handle hand);
  136
+    YAJL_API void yajl_reset_parser(yajl_handle hand);
137 137
 
138 138
     /** free a parser handle */    
139 139
     YAJL_API void yajl_free(yajl_handle handle);
1  ext/yajl/yajl_alloc.h
@@ -45,6 +45,7 @@
45 45
 #define YA_FREE(afs, ptr) (afs)->free((afs)->ctx, (ptr))
46 46
 #define YA_REALLOC(afs, ptr, sz) (afs)->realloc((afs)->ctx, (ptr), (sz))
47 47
 
  48
+YAJL_API
48 49
 void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf);
49 50
 
50 51
 #endif
7  ext/yajl/yajl_buf.h
@@ -50,24 +50,31 @@
50 50
 typedef struct yajl_buf_t * yajl_buf;
51 51
 
52 52
 /* allocate a new buffer */
  53
+YAJL_API
53 54
 yajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc);
54 55
 
55 56
 /* free the buffer */
  57
+YAJL_API
56 58
 void yajl_buf_free(yajl_buf buf);
57 59
 
58 60
 /* append a number of bytes to the buffer */
  61
+YAJL_API
59 62
 void yajl_buf_append(yajl_buf buf, const void * data, unsigned int len);
60 63
 
61 64
 /* empty the buffer */
  65
+YAJL_API
62 66
 void yajl_buf_clear(yajl_buf buf);
63 67
 
64 68
 /* get a pointer to the beginning of the buffer */
  69
+YAJL_API
65 70
 const unsigned char * yajl_buf_data(yajl_buf buf);
66 71
 
67 72
 /* get the length of the buffer */
  73
+YAJL_API
68 74
 unsigned int yajl_buf_len(yajl_buf buf);
69 75
 
70 76
 /* truncate the buffer */
  77
+YAJL_API
71 78
 void yajl_buf_truncate(yajl_buf buf, unsigned int len);
72 79
 
73 80
 #endif
3  ext/yajl/yajl_encode.h
@@ -36,16 +36,19 @@
36 36
 #include "yajl_buf.h"
37 37
 #include "api/yajl_gen.h"
38 38
 
  39
+YAJL_API
39 40
 void yajl_string_encode2(const yajl_print_t printer,
40 41
                          void * ctx,
41 42
                          const unsigned char * str,
42 43
                          unsigned int length,
43 44
                          unsigned int htmlSafe);
44 45
 
  46
+YAJL_API
45 47
 void yajl_string_encode(yajl_buf buf, const unsigned char * str,
46 48
                         unsigned int length,
47 49
                         unsigned int htmlSafe);
48 50
 
  51
+YAJL_API
49 52
 void yajl_string_decode(yajl_buf buf, const unsigned char * str,
50 53
                         unsigned int length);
51 54
 
4  ext/yajl/yajl_ext.h
@@ -63,8 +63,8 @@ static ID sym_allow_comments, sym_check_utf8, sym_pretty, sym_indent, sym_termin
63 63
 
64 64
 static void yajl_check_and_fire_callback(void * ctx);
65 65
 static void yajl_set_static_value(void * ctx, VALUE val);
66  
-void yajl_encode_part(void * wrapper, VALUE obj, VALUE io);
67  
-void yajl_parse_chunk(const unsigned char * chunk, unsigned int len, yajl_handle parser);
  66
+static void yajl_encode_part(void * wrapper, VALUE obj, VALUE io);
  67
+static void yajl_parse_chunk(const unsigned char * chunk, unsigned int len, yajl_handle parser);
68 68
 
69 69
 static int yajl_found_null(void * ctx);
70 70
 static int yajl_found_boolean(void * ctx, int boolean);
11  ext/yajl/yajl_lex.h
@@ -63,12 +63,16 @@ typedef enum {
63 63
 
64 64
 typedef struct yajl_lexer_t * yajl_lexer;
65 65
 
  66
+
  67
+YAJL_API
66 68
 yajl_lexer yajl_lex_alloc(yajl_alloc_funcs * alloc,
67 69
                           unsigned int allowComments,
68 70
                           unsigned int validateUTF8);
69 71
 
  72
+YAJL_API
70 73
 yajl_lexer yajl_lex_realloc(yajl_lexer orig);
71 74
 
  75
+YAJL_API
72 76
 void yajl_lex_free(yajl_lexer lexer);
73 77
 
74 78
 /**
@@ -93,11 +97,13 @@ n * error messages.
93 97
  * implications which require that the client choose a reasonable chunk
94 98
  * size to get adequate performance.
95 99
  */
  100
+YAJL_API
96 101
 yajl_tok yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText,
97 102
                       unsigned int jsonTextLen, unsigned int * offset,
98 103
                       const unsigned char ** outBuf, unsigned int * outLen);
99 104
 
100 105
 /** have a peek at the next token, but don't move the lexer forward */
  106
+YAJL_API
101 107
 yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText,
102 108
                        unsigned int jsonTextLen, unsigned int offset);
103 109
 
@@ -116,20 +122,25 @@ typedef enum {
116 122
     yajl_lex_unallowed_comment
117 123
 } yajl_lex_error;
118 124
 
  125
+YAJL_API
119 126
 const char * yajl_lex_error_to_string(yajl_lex_error error);
120 127
 
121 128
 /** allows access to more specific information about the lexical
122 129
  *  error when yajl_lex_lex returns yajl_tok_error. */
  130
+YAJL_API
123 131
 yajl_lex_error yajl_lex_get_error(yajl_lexer lexer);
124 132
 
125 133
 /** get the current offset into the most recently lexed json string. */
  134
+YAJL_API
126 135
 unsigned int yajl_lex_current_offset(yajl_lexer lexer);
127 136
 
128 137
 /** get the number of lines lexed by this lexer instance */
  138
+YAJL_API
129 139
 unsigned int yajl_lex_current_line(yajl_lexer lexer);
130 140
 
131 141
 /** get the number of chars lexed by this lexer instance since the last
132 142
  *  \n or \r */
  143
+YAJL_API
133 144
 unsigned int yajl_lex_current_char(yajl_lexer lexer);
134 145
 
135 146
 #endif
2  ext/yajl/yajl_parser.h
@@ -70,10 +70,12 @@ struct yajl_handle_t {
70 70
     yajl_alloc_funcs alloc;
71 71
 };
72 72
 
  73
+YAJL_API
73 74
 yajl_status
74 75
 yajl_do_parse(yajl_handle handle, const unsigned char * jsonText,
75 76
               unsigned int jsonTextLen);
76 77
 
  78
+YAJL_API
77 79
 unsigned char *
78 80
 yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText,
79 81
                          unsigned int jsonTextLen, int verbose);
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.