On 03/09/2017 10:36 AM, Matt Turner wrote:
On Wed, Mar 8, 2017 at 4:49 PM, Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
 src/mesa/main/samplerobj.c | 32 ++++----------------------------
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index c073f4221e..61b73e8905 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -50,32 +50,8 @@ _mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name)
          _mesa_HashLookup(ctx->Shared->SamplerObjects, name);
 }

-static struct gl_sampler_object *
-_mesa_lookup_samplerobj_locked(struct gl_context *ctx, GLuint name)

Wow, I hadn't realized how awful the names of the functions are:

_mesa_lookup_samplerobj
_mesa_lookup_samplerobj_locked
      lookup_samplerobj_locked

Yeah, very useful. :)



-{
-   if (name == 0)
-      return NULL;
-   else
-      return (struct gl_sampler_object *)
-         _mesa_HashLookupLocked(ctx->Shared->SamplerObjects, name);
-}
-
-static inline void
-begin_samplerobj_lookups(struct gl_context *ctx)
-{
-   _mesa_HashLockMutex(ctx->Shared->SamplerObjects);
-}
-
-
-static inline void
-end_samplerobj_lookups(struct gl_context *ctx)
-{
-   _mesa_HashUnlockMutex(ctx->Shared->SamplerObjects);
-}
-
-
 static inline struct gl_sampler_object *
-lookup_samplerobj_locked(struct gl_context *ctx, GLuint name)
+_mesa_lookup_samplerobj_locked(struct gl_context *ctx, GLuint name)

I was surprised to see these functions merging, given the extra if
(name == 0) check in the other one, but the one caller checks that
name is != 0 immediately before calling, so it seems fine.

static functions shouldn't have a _mesa_ prefix. So just remove the
_mesa_ and then the patch becomes

1) inline begin_samplerobj_lookups
2) inline end_samplerobj_lookups
3) replace call to _mesa_lookup_samplerobj_locked with lookup_samplerobj_locked
4) remove now unused _mesa_lookup_samplerobj_locked

I'd do 1 & 2 in one patch, and 3 & 4 in a separate patch.

Sounds good.


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to