From: Kenneth Graunke Date: Fri, 19 Feb 2010 07:50:55 +0000 (-0800) Subject: Remove _mesa_strlen in favor of plain strlen. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21d0c70b4b1c18dc1c3ac7d0fbd8a903d60f8be7;p=mesa.git Remove _mesa_strlen in favor of plain strlen. --- diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c index b4bfb40eb1d..79fcbc71c29 100644 --- a/src/mesa/main/cpuinfo.c +++ b/src/mesa/main/cpuinfo.c @@ -103,7 +103,7 @@ _mesa_get_cpu_string(void) #endif - assert(_mesa_strlen(buffer) < MAX_STRING); + assert(strlen(buffer) < MAX_STRING); return buffer; } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 87c1fac28a0..6449f39c7f7 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -574,8 +574,8 @@ _mesa_extension_is_enabled( GLcontext *ctx, const char *name ) static char * append(const char *a, const char *b) { - const GLuint aLen = a ? _mesa_strlen(a) : 0; - const GLuint bLen = b ? _mesa_strlen(b) : 0; + const GLuint aLen = a ? strlen(a) : 0; + const GLuint bLen = b ? strlen(b) : 0; char *s = _mesa_calloc(aLen + bLen + 1); if (s) { if (a) @@ -677,12 +677,12 @@ _mesa_make_extension_string( GLcontext *ctx ) /* first, compute length of the extension string */ for (i = 0 ; i < Elements(default_extensions) ; i++) { if (extension_enabled(ctx, i)) { - extStrLen += (GLuint)_mesa_strlen(default_extensions[i].name) + 1; + extStrLen += (GLuint) strlen(default_extensions[i].name) + 1; } } if (extraExt) - extStrLen += _mesa_strlen(extraExt) + 1; /* +1 for space */ + extStrLen += strlen(extraExt) + 1; /* +1 for space */ /* allocate the extension string */ s = (char *) _mesa_malloc(extStrLen); @@ -693,7 +693,7 @@ _mesa_make_extension_string( GLcontext *ctx ) extStrLen = 0; for (i = 0 ; i < Elements(default_extensions) ; i++) { if (extension_enabled(ctx, i)) { - GLuint len = (GLuint)_mesa_strlen(default_extensions[i].name); + GLuint len = (GLuint) strlen(default_extensions[i].name); _mesa_memcpy(s + extStrLen, default_extensions[i].name, len); extStrLen += len; s[extStrLen] = ' '; diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 78c5cada753..dc24ea0740b 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -841,13 +841,6 @@ _mesa_getenv( const char *var ) /** \name String */ /*@{*/ -/** Wrapper around strlen() */ -size_t -_mesa_strlen( const char *s ) -{ - return strlen(s); -} - /** Wrapper around strcmp() */ int _mesa_strcmp( const char *s1, const char *s2 ) @@ -870,7 +863,7 @@ char * _mesa_strdup( const char *s ) { if (s) { - size_t l = _mesa_strlen(s); + size_t l = strlen(s); char *s2 = (char *) _mesa_malloc(l + 1); if (s2) strcpy(s2, s); diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 192dffe8c6f..f66cf0d6f90 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -611,9 +611,6 @@ _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size, extern char * _mesa_getenv( const char *var ); -extern size_t -_mesa_strlen( const char *s ); - extern int _mesa_strcmp( const char *s1, const char *s2 ); diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index d0dc7e551c9..b9c84eb7925 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -447,7 +447,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, return; } if (length == NULL || length[i] < 0) - offsets[i] = _mesa_strlen(string[i]); + offsets[i] = strlen(string[i]); else offsets[i] = length[i]; /* accumulate string lengths */ diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 7e3040a6ef4..a77ff7c5b15 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -910,7 +910,7 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) switch (pname) { case GL_PROGRAM_LENGTH_ARB: *params - = prog->String ? (GLint) _mesa_strlen((char *) prog->String) : 0; + = prog->String ? (GLint) strlen((char *) prog->String) : 0; return; case GL_PROGRAM_FORMAT_ARB: *params = prog->Format; @@ -1091,7 +1091,7 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) } if (prog->String) - _mesa_memcpy(dst, prog->String, _mesa_strlen((char *) prog->String)); + _mesa_memcpy(dst, prog->String, strlen((char *) prog->String)); else *dst = '\0'; } diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c index 28dbf77b666..3e26c43c480 100644 --- a/src/mesa/shader/atifragshader.c +++ b/src/mesa/shader/atifragshader.c @@ -115,7 +115,7 @@ create_dst_mod_str(GLuint mod) if (mod & GL_SATURATE_BIT_ATI) strncat(ret_str, "|SAT", 1024); - if (_mesa_strlen(ret_str) == 0) + if (strlen(ret_str) == 0) strncat(ret_str, "NONE", 1024); return ret_str; } diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 8ee7c930626..b219dfa6e77 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -378,7 +378,7 @@ Peek_Token(struct parse_state *parseState, GLubyte *token) parseState->pos += (-i); return GL_FALSE; } - len = (GLint)_mesa_strlen((const char *) token); + len = (GLint) strlen((const char *) token); parseState->pos += (i - len); return GL_TRUE; } diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index c3b10f5d9b8..394b6a42d71 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -260,7 +260,7 @@ _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params) *params = prog->Target; return; case GL_PROGRAM_LENGTH_NV: - *params = prog->String ?(GLint)_mesa_strlen((char *) prog->String) : 0; + *params = prog->String ?(GLint) strlen((char *) prog->String) : 0; return; case GL_PROGRAM_RESIDENT_NV: *params = prog->Resident; @@ -297,7 +297,7 @@ _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program) } if (prog->String) { - MEMCPY(program, prog->String, _mesa_strlen((char *) prog->String)); + MEMCPY(program, prog->String, strlen((char *) prog->String)); } else { program[0] = 0; diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index baff7658d18..90f795ab16a 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -232,7 +232,7 @@ Peek_Token(struct parse_state *parseState, GLubyte *token) parseState->pos += (-i); return GL_FALSE; } - len = (GLint)_mesa_strlen((const char *) token); + len = (GLint) strlen((const char *) token); parseState->pos += (i - len); return GL_TRUE; } diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index d4970c4e44e..0c52c254b52 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -538,7 +538,7 @@ _mesa_lookup_parameter_index(const struct gl_program_parameter_list *paramList, for (i = 0; i < (GLint) paramList->NumParameters; i++) { if (paramList->Parameters[i].Name && _mesa_strncmp(paramList->Parameters[i].Name, name, nameLen) == 0 - && _mesa_strlen(paramList->Parameters[i].Name) == (size_t)nameLen) + && strlen(paramList->Parameters[i].Name) == (size_t)nameLen) return i; } } @@ -723,7 +723,7 @@ _mesa_longest_parameter_name(const struct gl_program_parameter_list *list, return 0; for (i = 0; i < list->NumParameters; i++) { if (list->Parameters[i].Type == type) { - GLuint len = _mesa_strlen(list->Parameters[i].Name); + GLuint len = strlen(list->Parameters[i].Name); if (len > maxLen) maxLen = len; } diff --git a/src/mesa/shader/prog_uniform.c b/src/mesa/shader/prog_uniform.c index 0642713148c..cdfe158deb2 100644 --- a/src/mesa/shader/prog_uniform.c +++ b/src/mesa/shader/prog_uniform.c @@ -142,7 +142,7 @@ _mesa_longest_uniform_name(const struct gl_uniform_list *list) GLint max = 0; GLuint i; for (i = 0; list && i < list->NumUniforms; i++) { - GLint len = (GLint)_mesa_strlen(list->Uniforms[i].Name); + GLint len = (GLint) strlen(list->Uniforms[i].Name); if (len > max) max = len; } diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 33964e0c3b6..65842ac0c8f 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -167,7 +167,7 @@ static void parse_identifier_str(slang_parse_ctx * C, char **id) { *id = (char *) C->I; - C->I += _mesa_strlen(*id) + 1; + C->I += strlen(*id) + 1; } static slang_atom @@ -176,7 +176,7 @@ parse_identifier(slang_parse_ctx * C) const char *id; id = (const char *) C->I; - C->I += _mesa_strlen(id) + 1; + C->I += strlen(id) + 1; return slang_atom_pool_atom(C->atoms, id); } @@ -298,9 +298,9 @@ parse_float(slang_parse_ctx * C, float *number) parse_identifier_str(C, &fractional); parse_identifier_str(C, &exponent); - whole = (char *) _slang_alloc((_mesa_strlen(integral) + - _mesa_strlen(fractional) + - _mesa_strlen(exponent) + 3) * sizeof(char)); + whole = (char *) _slang_alloc((strlen(integral) + + strlen(fractional) + + strlen(exponent) + 3) * sizeof(char)); if (whole == NULL) { slang_info_log_memory(C->L); RETURN0; diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 0f670360ee8..fa3a63ea4be 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -754,7 +754,7 @@ instruction_annotation(gl_inst_opcode opcode, char *dstAnnot, s = (char *) malloc(len); sprintf(s, "%s = %s %s %s %s", dstAnnot, srcAnnot0, operator, srcAnnot1, srcAnnot2); - assert(_mesa_strlen(s) < len); + assert(strlen(s) < len); free(dstAnnot); free(srcAnnot0); diff --git a/src/mesa/shader/slang/slang_label.c b/src/mesa/shader/slang/slang_label.c index 1ca1ef0c7c0..12406213656 100644 --- a/src/mesa/shader/slang/slang_label.c +++ b/src/mesa/shader/slang/slang_label.c @@ -32,7 +32,7 @@ _slang_label_new_unique(const char *name) static int id = 1; slang_label *l = (slang_label *) _slang_alloc(sizeof(slang_label)); if (l) { - l->Name = (char *) _slang_alloc(_mesa_strlen(name) + 10); + l->Name = (char *) _slang_alloc(strlen(name) + 10); if (!l->Name) { _mesa_free(l); return NULL; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 9c90d5c5319..2906cb17c4b 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -603,7 +603,7 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) for (i = 0; i < shProg->NumShaders; i++) { const struct gl_shader *shader = shProg->Shaders[i]; if (shader->Type == shaderType) { - shaderLengths[i] = _mesa_strlen(shader->Source); + shaderLengths[i] = strlen(shader->Source); totalLen += shaderLengths[i]; if (!firstShader) firstShader = shader; diff --git a/src/mesa/shader/slang/slang_mem.c b/src/mesa/shader/slang/slang_mem.c index dc5707a39b9..c37e12fb7f9 100644 --- a/src/mesa/shader/slang/slang_mem.c +++ b/src/mesa/shader/slang/slang_mem.c @@ -212,7 +212,7 @@ char * _slang_strdup(const char *s) { if (s) { - size_t l = _mesa_strlen(s); + size_t l = strlen(s); char *s2 = (char *) _slang_alloc(l + 1); if (s2) strcpy(s2, s); diff --git a/src/mesa/shader/slang/slang_utility.c b/src/mesa/shader/slang/slang_utility.c index 950fba5611c..e3b0491d97f 100644 --- a/src/mesa/shader/slang/slang_utility.c +++ b/src/mesa/shader/slang/slang_utility.c @@ -35,7 +35,7 @@ char * slang_string_concat (char *dst, const char *src) { - return strcpy (dst + _mesa_strlen (dst), src); + return strcpy (dst + strlen (dst), src); } diff --git a/src/mesa/shader/slang/slang_utility.h b/src/mesa/shader/slang/slang_utility.h index 3762cc96795..10071f2c174 100644 --- a/src/mesa/shader/slang/slang_utility.h +++ b/src/mesa/shader/slang/slang_utility.h @@ -34,7 +34,7 @@ #define slang_string_compare(str1, str2) _mesa_strcmp (str1, str2) #define slang_string_copy(dst, src) strcpy (dst, src) -#define slang_string_length(str) _mesa_strlen (str) +#define slang_string_length(str) strlen (str) char *slang_string_concat (char *, const char *);