gpu os abstraction: strcpy, strncpy, strcat, strcmp, strncmp, strlen all using Linux ones now

This commit is contained in:
Matt Sealey
2011-08-26 10:40:35 -05:00
parent b564e29f61
commit 72edabd161
3 changed files with 4 additions and 137 deletions

View File

@@ -297,9 +297,9 @@ kgsl_memarena_create(int aperture_id, int mmu_virtualized, unsigned int hostbase
// define unique mutex for each memory arena instance
id_str[0] = (char) (count + '0');
id_str[1] = '\0';
kos_strcpy(name, "GSL_memory_arena_");
len = kos_strlen(name);
kos_strcpy(&name[len], id_str);
strcpy(name, "GSL_memory_arena_");
len = strlen(name);
strcpy(&name[len], id_str);
memarena->mutex = kos_mutex_create(name);

View File

@@ -161,79 +161,7 @@ KOS_API void kos_enable_memoryleakcheck(void);
KOS_API void kos_memoryfence(void);
//////////////////////////////////////////////////////////////////////////////
// string API
//////////////////////////////////////////////////////////////////////////////
/*-------------------------------------------------------------------*//*!
* \external
* \brief Perform a string copy.
*
*
* \param void* strdestination Pointer to destination memory.
* \param void* strsource Pointer to the source string.
* \return Zero if ok, othervise an error code.
*//*-------------------------------------------------------------------*/
KOS_API char* kos_strcpy(char* strdestination, const char* strsource);
/*-------------------------------------------------------------------*//*!
* \external
* \brief Perform a string copy with given length.
*
*
* \param void* destination Pointer to destination memory.
* \param void* source Pointer to the source string.
* \param int length Amount of bytes to copy.
* \return Returns the destination pointer.
*//*-------------------------------------------------------------------*/
KOS_API char* kos_strncpy(char* destination, const char* source, int length);
/*-------------------------------------------------------------------*//*!
* \external
* \brief Append source string to destination string.
*
*
* \param void* strdestination Pointer to destination string.
* \param void* strsource Pointer to the source string.
* \return Returns the destination pointer.
*//*-------------------------------------------------------------------*/
KOS_API char* kos_strcat(char* strdestination, const char* strsource);
/*-------------------------------------------------------------------*//*!
* \external
* \brief Compare two strings.
*
*
* \param void* string1 Pointer to first string.
* \param void* string2 Pointer to second string.
* \param void* length Number of bytes to compare.
* \return Zero if identical, >0 if first string is lexically greater <0 if not.
*//*-------------------------------------------------------------------*/
KOS_API int kos_strcmp(const char* string1, const char* string2);
/*-------------------------------------------------------------------*//*!
* \external
* \brief Compares two strings of given length.
*
*
* \param void* string1 Pointer to first string.
* \param void* string2 Pointer to second string.
* \param void* length Number of bytes to compare.
* \return Zero if identical, >0 if first string is lexically greater <0 if not.
*//*-------------------------------------------------------------------*/
KOS_API int kos_strncmp(const char* string1, const char* string2, int length);
/*-------------------------------------------------------------------*//*!
* \external
* \brief Calculates the length of a string..
*
*
* \param void* string Pointer to the string.
* \return Lenght of the string in bytes.
*//*-------------------------------------------------------------------*/
KOS_API int kos_strlen(const char* string);
/*-------------------------------------------------------------------*//*!
* \external
* \brief Convert an numeric ascii string to integer value.
*
*
* \param void* string Pointer to the string.
* \return Integer value extracted from the string.
*//*-------------------------------------------------------------------*/
KOS_API int kos_atoi(const char* string);
/*-------------------------------------------------------------------*//*!
* \external

View File

@@ -146,67 +146,6 @@ kos_enable_memoryleakcheck(void)
KOS_DBGFLAGS_SET(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
}
//////////////////////////////////////////////////////////////////////////////
// string API
//////////////////////////////////////////////////////////////////////////////
KOS_API char*
kos_strcpy(char* strdestination, const char* strsource)
{
KOS_ASSERT(strdestination);
KOS_ASSERT(strsource);
return strcpy(strdestination, strsource);
}
//----------------------------------------------------------------------------
KOS_API char*
kos_strncpy(char* destination, const char* source, int length)
{
KOS_ASSERT(destination);
KOS_ASSERT(source);
return strncpy(destination, source, length);
}
//----------------------------------------------------------------------------
KOS_API char*
kos_strcat(char* strdestination, const char* strsource)
{
KOS_ASSERT(strdestination);
KOS_ASSERT(strsource);
return strcat(strdestination, strsource);
}
//----------------------------------------------------------------------------
KOS_API int
kos_strcmp(const char* string1, const char* string2)
{
KOS_ASSERT(string1);
KOS_ASSERT(string2);
return strcmp(string1, string2);
}
//----------------------------------------------------------------------------
KOS_API int
kos_strncmp(const char* string1, const char* string2, int length)
{
KOS_ASSERT(string1);
KOS_ASSERT(string2);
return strncmp(string1, string2, length);
}
//----------------------------------------------------------------------------
KOS_API int
kos_strlen(const char* string)
{
KOS_ASSERT(string);
return strlen(string);
}
//////////////////////////////////////////////////////////////////////////////
// sync API
//////////////////////////////////////////////////////////////////////////////