[Mesa-dev] [PATCH 1/7] mesa: Remove _mesa_lookup_enum_by_name().
Eric Anholt
eric at anholt.net
Fri Sep 20 18:52:19 PDT 2013
It's been unused for a long time. I stopped digging through git history
as of 2009.
---
src/mapi/glapi/gen/gl_enums.py | 29 -----------------------------
src/mesa/main/enums.h | 2 --
src/mesa/main/tests/enum_strings.cpp | 32 --------------------------------
3 files changed, 63 deletions(-)
diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index 806d384..d8f1045 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -59,21 +59,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
typedef int (*cfunc)(const void *, const void *);
/**
- * Compare a key name to an element in the \c all_enums array.
- *
- * \c bsearch always passes the key as the first parameter and the pointer
- * to the array element as the second parameter. We can elimiate some
- * extra work by taking advantage of that fact.
- *
- * \param a Pointer to the desired enum name.
- * \param b Pointer to an element of the \c all_enums array.
- */
-static int compar_name( const char *a, const enum_elt *b )
-{
- return strcmp( a, & enum_string_table[ b->offset ] );
-}
-
-/**
* Compare a key enum value to an element in the \c all_enums array.
*
* \c bsearch always passes the key as the first parameter and the pointer
@@ -147,20 +132,6 @@ _mesa_lookup_prim_by_nr(GLuint nr)
}
-int _mesa_lookup_enum_by_name( const char *symbol )
-{
- enum_elt * f = NULL;
-
- if ( symbol != NULL ) {
- f = (enum_elt *) _mesa_bsearch(symbol, all_enums,
- Elements(all_enums),
- sizeof( enum_elt ),
- (cfunc) compar_name);
- }
-
- return (f != NULL) ? f->n : -1;
-}
-
"""
return
diff --git a/src/mesa/main/enums.h b/src/mesa/main/enums.h
index 556c1db..36c053d 100644
--- a/src/mesa/main/enums.h
+++ b/src/mesa/main/enums.h
@@ -44,6 +44,4 @@ extern const char *_mesa_lookup_enum_by_nr( int nr );
*/
const char *_mesa_lookup_prim_by_nr( unsigned nr );
-extern int _mesa_lookup_enum_by_name( const char *symbol );
-
#endif
diff --git a/src/mesa/main/tests/enum_strings.cpp b/src/mesa/main/tests/enum_strings.cpp
index 1dae60f..c8df819 100644
--- a/src/mesa/main/tests/enum_strings.cpp
+++ b/src/mesa/main/tests/enum_strings.cpp
@@ -34,7 +34,6 @@ struct enum_info {
};
extern const struct enum_info everything[];
-extern const struct enum_info alternate_names[];
TEST(EnumStrings, LookUpByNumber)
{
@@ -44,25 +43,6 @@ TEST(EnumStrings, LookUpByNumber)
}
}
-TEST(EnumStrings, LookUpByName)
-{
- for (unsigned i = 0; everything[i].name != NULL; i++) {
- EXPECT_EQ(everything[i].value,
- _mesa_lookup_enum_by_name(everything[i].name));
- }
-}
-
-TEST(EnumStrings, LookUpByDuplicateName)
-{
- /* Some enum values have multiple names. Try to find some values
- * by alternate names.
- */
- for (unsigned i = 0; alternate_names[i].name != NULL; i++) {
- EXPECT_EQ(alternate_names[i].value,
- _mesa_lookup_enum_by_name(alternate_names[i].name));
- }
-}
-
TEST(EnumStrings, LookUpUnknownNumber)
{
EXPECT_STRCASEEQ("0xEEEE", _mesa_lookup_enum_by_nr(0xEEEE));
@@ -1866,15 +1846,3 @@ const struct enum_info everything[] = {
{ 0x19262, "GL_RASTER_POSITION_UNCLIPPED_IBM" },
{ 0, NULL }
};
-
-const struct enum_info alternate_names[] = {
- { 0x8513, "GL_TEXTURE_CUBE_MAP_ARB" },
- { 0x8514, "GL_TEXTURE_BINDING_CUBE_MAP_ARB" },
- { 0x8515, "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB" },
- { 0x8516, "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB" },
- { 0x8517, "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB" },
- { 0x8518, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB" },
- { 0x8519, "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB" },
- { 0x851A, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB" },
- { 0, NULL }
-};
--
1.8.4.rc3
More information about the mesa-dev
mailing list