diff options
author | Brian Paul <[email protected]> | 2006-11-16 22:31:34 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-11-16 22:31:34 +0000 |
commit | 523f5cfeb537e52baa892148b7b050fb076ef1b0 (patch) | |
tree | f9eaf88ea712a5236ad52c4f33b921206eeb9b99 /src/mesa/shader/slang/slang_utility.c | |
parent | 1f0c86ee350f168a5b7420bfda7d80365432c811 (diff) |
Add a lot of const qualifiers for const-correctness.
New comments, misc clean-ups.
Diffstat (limited to 'src/mesa/shader/slang/slang_utility.c')
-rw-r--r-- | src/mesa/shader/slang/slang_utility.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mesa/shader/slang/slang_utility.c b/src/mesa/shader/slang/slang_utility.c index 54fcc8a2382..28837248df5 100644 --- a/src/mesa/shader/slang/slang_utility.c +++ b/src/mesa/shader/slang/slang_utility.c @@ -160,11 +160,16 @@ void slang_atom_pool_destruct (slang_atom_pool *pool) } } -slang_atom slang_atom_pool_atom (slang_atom_pool *pool, const char *id) +/** + * Search atom pool for atom with the given name. + * If name is not found, create new atom (but don't insert into pool?) + */ +slang_atom slang_atom_pool_atom (const slang_atom_pool *pool, const char *id) { GLuint hash; const char *p = id; - slang_atom_entry **entry; + slang_atom_entry * const * entry; + slang_atom_entry **newEntry = NULL; hash = 0; while (*p != '\0') @@ -187,15 +192,15 @@ slang_atom slang_atom_pool_atom (slang_atom_pool *pool, const char *id) entry = &(**entry).next; } - *entry = (slang_atom_entry *) slang_alloc_malloc (sizeof (slang_atom_entry)); - if (*entry == NULL) + *newEntry = (slang_atom_entry *) slang_alloc_malloc (sizeof (slang_atom_entry)); + if (*newEntry == NULL) return SLANG_ATOM_NULL; - (**entry).next = NULL; - (**entry).id = slang_string_duplicate (id); - if ((**entry).id == NULL) + (**newEntry).next = NULL; + (**newEntry).id = slang_string_duplicate (id); + if ((**newEntry).id == NULL) return SLANG_ATOM_NULL; - return (slang_atom) (**entry).id; + return (slang_atom) (**newEntry).id; } const char *slang_atom_pool_id (slang_atom_pool *pool, slang_atom atom) |