[libdrm:PATCH 1/2] radeon: Hide non-public symbols.
Cyril Brulebois
kibi at debian.org
Sat Mar 5 11:09:49 PST 2011
There's no reason to export those symbols, since they are only meant to
be used internally, so mark them as such. An alternative might be to use
a linker script.
Signed-off-by: Cyril Brulebois <kibi at debian.org>
---
radeon/bof.c | 36 ++++++++++++++++++------------------
radeon/bof.h | 10 ++++++++++
2 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/radeon/bof.c b/radeon/bof.c
index 0598cc6..7d178cb 100644
--- a/radeon/bof.c
+++ b/radeon/bof.c
@@ -48,7 +48,7 @@ static int bof_entry_grow(bof_t *bof)
/*
* object
*/
-bof_t *bof_object(void)
+_X_HIDDEN bof_t *bof_object(void)
{
bof_t *object;
@@ -61,7 +61,7 @@ bof_t *bof_object(void)
return object;
}
-bof_t *bof_object_get(bof_t *object, const char *keyname)
+_X_HIDDEN bof_t *bof_object_get(bof_t *object, const char *keyname)
{
unsigned i;
@@ -73,7 +73,7 @@ bof_t *bof_object_get(bof_t *object, const char *keyname)
return NULL;
}
-int bof_object_set(bof_t *object, const char *keyname, bof_t *value)
+_X_HIDDEN int bof_object_set(bof_t *object, const char *keyname, bof_t *value)
{
bof_t *key;
int r;
@@ -97,7 +97,7 @@ int bof_object_set(bof_t *object, const char *keyname, bof_t *value)
/*
* array
*/
-bof_t *bof_array(void)
+_X_HIDDEN bof_t *bof_array(void)
{
bof_t *array = bof_object();
@@ -108,7 +108,7 @@ bof_t *bof_array(void)
return array;
}
-int bof_array_append(bof_t *array, bof_t *value)
+_X_HIDDEN int bof_array_append(bof_t *array, bof_t *value)
{
int r;
if (array->type != BOF_TYPE_ARRAY)
@@ -122,14 +122,14 @@ int bof_array_append(bof_t *array, bof_t *value)
return 0;
}
-bof_t *bof_array_get(bof_t *bof, unsigned i)
+_X_HIDDEN bof_t *bof_array_get(bof_t *bof, unsigned i)
{
if (!bof_is_array(bof) || i >= bof->array_size)
return NULL;
return bof->array[i];
}
-unsigned bof_array_size(bof_t *bof)
+_X_HIDDEN unsigned bof_array_size(bof_t *bof)
{
if (!bof_is_array(bof))
return 0;
@@ -139,7 +139,7 @@ unsigned bof_array_size(bof_t *bof)
/*
* blob
*/
-bof_t *bof_blob(unsigned size, void *value)
+_X_HIDDEN bof_t *bof_blob(unsigned size, void *value)
{
bof_t *blob = bof_object();
@@ -157,14 +157,14 @@ bof_t *bof_blob(unsigned size, void *value)
return blob;
}
-unsigned bof_blob_size(bof_t *bof)
+_X_HIDDEN unsigned bof_blob_size(bof_t *bof)
{
if (!bof_is_blob(bof))
return 0;
return bof->size - 12;
}
-void *bof_blob_value(bof_t *bof)
+_X_HIDDEN void *bof_blob_value(bof_t *bof)
{
if (!bof_is_blob(bof))
return NULL;
@@ -174,7 +174,7 @@ void *bof_blob_value(bof_t *bof)
/*
* string
*/
-bof_t *bof_string(const char *value)
+_X_HIDDEN bof_t *bof_string(const char *value)
{
bof_t *string = bof_object();
@@ -195,7 +195,7 @@ bof_t *bof_string(const char *value)
/*
* int32
*/
-bof_t *bof_int32(int32_t value)
+_X_HIDDEN bof_t *bof_int32(int32_t value)
{
bof_t *int32 = bof_object();
@@ -213,7 +213,7 @@ bof_t *bof_int32(int32_t value)
return int32;
}
-int32_t bof_int32_value(bof_t *bof)
+_X_HIDDEN int32_t bof_int32_value(bof_t *bof)
{
return *((uint32_t*)bof->value);
}
@@ -271,7 +271,7 @@ static void bof_print_rec(bof_t *bof, int level, int entry)
}
}
-void bof_print(bof_t *bof)
+_X_HIDDEN void bof_print(bof_t *bof)
{
bof_print_rec(bof, 0, 0);
}
@@ -333,7 +333,7 @@ out_err:
return -EINVAL;
}
-bof_t *bof_load_file(const char *filename)
+_X_HIDDEN bof_t *bof_load_file(const char *filename)
{
bof_t *root = bof_object();
int r;
@@ -369,12 +369,12 @@ out_err:
return NULL;
}
-void bof_incref(bof_t *bof)
+_X_HIDDEN void bof_incref(bof_t *bof)
{
bof->refcount++;
}
-void bof_decref(bof_t *bof)
+_X_HIDDEN void bof_decref(bof_t *bof)
{
unsigned i;
@@ -436,7 +436,7 @@ static int bof_file_write(bof_t *bof, FILE *file)
return 0;
}
-int bof_dump_file(bof_t *bof, const char *filename)
+_X_HIDDEN int bof_dump_file(bof_t *bof, const char *filename)
{
unsigned i;
int r = 0;
diff --git a/radeon/bof.h b/radeon/bof.h
index 014affb..14cf7e5 100644
--- a/radeon/bof.h
+++ b/radeon/bof.h
@@ -87,4 +87,14 @@ static inline int bof_is_int32(bof_t *bof){return (bof->type == BOF_TYPE_INT32);
static inline int bof_is_array(bof_t *bof){return (bof->type == BOF_TYPE_ARRAY);}
static inline int bof_is_string(bof_t *bof){return (bof->type == BOF_TYPE_STRING);}
+/* Taken from X11/Xfuncproto.h, keeping only _X_HIDDEN to hide symbols
+ * which shouldn't be exported */
+#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__)
+# define _X_HIDDEN __attribute__((visibility("hidden")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define _X_HIDDEN __hidden
+#else /* not gcc >= 4 and not Sun Studio >= 8 */
+# define _X_HIDDEN
+#endif /* GNUC >= 4 */
+
#endif
--
1.7.4.1
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
--
_______________________________________________
Dri-devel mailing list
Dri-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel
More information about the dri-devel
mailing list