[PATCH libdrm 2/9] amdgpu/util_hash: hide private symbols from global namespace
Emil Velikov
emil.l.velikov at gmail.com
Fri Aug 7 09:44:56 PDT 2015
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
amdgpu/util_hash.c | 29 +++++++++++++++--------------
amdgpu/util_hash.h | 34 +++++++++++++++++++++-------------
2 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/amdgpu/util_hash.c b/amdgpu/util_hash.c
index b1e12c4..7e59041 100644
--- a/amdgpu/util_hash.c
+++ b/amdgpu/util_hash.c
@@ -214,8 +214,8 @@ static struct util_node **util_hash_find_node(struct util_hash *hash, unsigned a
return node;
}
-struct util_hash_iter util_hash_insert(struct util_hash *hash,
- unsigned key, void *data)
+drm_private struct util_hash_iter
+util_hash_insert(struct util_hash *hash, unsigned key, void *data)
{
util_data_might_grow(hash->data.d);
@@ -234,7 +234,7 @@ struct util_hash_iter util_hash_insert(struct util_hash *hash,
}
}
-struct util_hash * util_hash_create(void)
+drm_private struct util_hash *util_hash_create(void)
{
struct util_hash *hash = malloc(sizeof(struct util_hash));
if (!hash)
@@ -257,7 +257,7 @@ struct util_hash * util_hash_create(void)
return hash;
}
-void util_hash_delete(struct util_hash *hash)
+drm_private void util_hash_delete(struct util_hash *hash)
{
struct util_node *e_for_x = (struct util_node *)(hash->data.d);
struct util_node **bucket = (struct util_node **)(hash->data.d->buckets);
@@ -275,22 +275,22 @@ void util_hash_delete(struct util_hash *hash)
free(hash);
}
-struct util_hash_iter util_hash_find(struct util_hash *hash,
- unsigned key)
+drm_private struct util_hash_iter
+util_hash_find(struct util_hash *hash, unsigned key)
{
struct util_node **nextNode = util_hash_find_node(hash, key);
struct util_hash_iter iter = {hash, *nextNode};
return iter;
}
-unsigned util_hash_iter_key(struct util_hash_iter iter)
+drm_private unsigned util_hash_iter_key(struct util_hash_iter iter)
{
if (!iter.node || iter.hash->data.e == iter.node)
return 0;
return iter.node->key;
}
-void * util_hash_iter_data(struct util_hash_iter iter)
+drm_private void *util_hash_iter_data(struct util_hash_iter iter)
{
if (!iter.node || iter.hash->data.e == iter.node)
return 0;
@@ -327,21 +327,21 @@ static struct util_node *util_hash_data_next(struct util_node *node)
return a.e;
}
-struct util_hash_iter util_hash_iter_next(struct util_hash_iter iter)
+drm_private struct util_hash_iter
+util_hash_iter_next(struct util_hash_iter iter)
{
struct util_hash_iter next = {iter.hash, util_hash_data_next(iter.node)};
return next;
}
-int util_hash_iter_is_null(struct util_hash_iter iter)
+drm_private int util_hash_iter_is_null(struct util_hash_iter iter)
{
if (!iter.node || iter.node == iter.hash->data.e)
return 1;
return 0;
}
-void * util_hash_take(struct util_hash *hash,
- unsigned akey)
+drm_private void *util_hash_take(struct util_hash *hash, unsigned akey)
{
struct util_node **node = util_hash_find_node(hash, akey);
if (*node != hash->data.e) {
@@ -356,13 +356,14 @@ void * util_hash_take(struct util_hash *hash,
return 0;
}
-struct util_hash_iter util_hash_first_node(struct util_hash *hash)
+drm_private struct util_hash_iter util_hash_first_node(struct util_hash *hash)
{
struct util_hash_iter iter = {hash, util_data_first_node(hash->data.d)};
return iter;
}
-struct util_hash_iter util_hash_erase(struct util_hash *hash, struct util_hash_iter iter)
+drm_private struct util_hash_iter
+util_hash_erase(struct util_hash *hash, struct util_hash_iter iter)
{
struct util_hash_iter ret = iter;
struct util_node *node = iter.node;
diff --git a/amdgpu/util_hash.h b/amdgpu/util_hash.h
index 8e0f9a2..01a4779 100644
--- a/amdgpu/util_hash.h
+++ b/amdgpu/util_hash.h
@@ -44,8 +44,14 @@
#ifndef UTIL_HASH_H
#define UTIL_HASH_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdbool.h>
+#include "libdrm_macros.h"
+
struct util_hash;
struct util_node;
@@ -55,8 +61,8 @@ struct util_hash_iter {
};
-struct util_hash *util_hash_create(void);
-void util_hash_delete(struct util_hash *hash);
+drm_private struct util_hash *util_hash_create(void);
+drm_private void util_hash_delete(struct util_hash *hash);
/**
@@ -65,8 +71,8 @@ void util_hash_delete(struct util_hash *hash);
* in the collision list.
* Function returns iterator pointing to the inserted item in the hash.
*/
-struct util_hash_iter util_hash_insert(struct util_hash *hash, unsigned key,
- void *data);
+drm_private struct util_hash_iter
+util_hash_insert(struct util_hash *hash, unsigned key, void *data);
/**
* Removes the item pointed to by the current iterator from the hash.
@@ -75,25 +81,27 @@ struct util_hash_iter util_hash_insert(struct util_hash *hash, unsigned key,
* Function returns iterator pointing to the item after the removed one in
* the hash.
*/
-struct util_hash_iter util_hash_erase(struct util_hash *hash,
- struct util_hash_iter iter);
+drm_private struct util_hash_iter
+util_hash_erase(struct util_hash *hash, struct util_hash_iter iter);
-void *util_hash_take(struct util_hash *hash, unsigned key);
+drm_private void *util_hash_take(struct util_hash *hash, unsigned key);
-struct util_hash_iter util_hash_first_node(struct util_hash *hash);
+drm_private struct util_hash_iter util_hash_first_node(struct util_hash *hash);
/**
* Return an iterator pointing to the first entry in the collision list.
*/
-struct util_hash_iter util_hash_find(struct util_hash *hash, unsigned key);
+drm_private struct util_hash_iter
+util_hash_find(struct util_hash *hash, unsigned key);
-int util_hash_iter_is_null(struct util_hash_iter iter);
-unsigned util_hash_iter_key(struct util_hash_iter iter);
-void *util_hash_iter_data(struct util_hash_iter iter);
+drm_private int util_hash_iter_is_null(struct util_hash_iter iter);
+drm_private unsigned util_hash_iter_key(struct util_hash_iter iter);
+drm_private void *util_hash_iter_data(struct util_hash_iter iter);
-struct util_hash_iter util_hash_iter_next(struct util_hash_iter iter);
+drm_private struct util_hash_iter
+util_hash_iter_next(struct util_hash_iter iter);
#endif
--
2.5.0
More information about the dri-devel
mailing list