git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Various Changes
[tpg/acess2.git]
/
Kernel
/
lib.c
diff --git
a/Kernel/lib.c
b/Kernel/lib.c
index
3399d3d
..
d3fff54
100644
(file)
--- a/
Kernel/lib.c
+++ b/
Kernel/lib.c
@@
-70,7
+70,7
@@
int tolower(int c)
* \fn int strucmp(char *Str1, char *Str2)
* \brief Compare \a Str1 and \a Str2 case-insensitively
*/
* \fn int strucmp(char *Str1, char *Str2)
* \brief Compare \a Str1 and \a Str2 case-insensitively
*/
-int strucmp(c
har *Str1,
char *Str2)
+int strucmp(c
onst char *Str1, const
char *Str2)
{
while(*Str1 && tolower(*Str1) == tolower(*Str2))
Str1++, Str2++;
{
while(*Str1 && tolower(*Str1) == tolower(*Str2))
Str1++, Str2++;
@@
-81,7
+81,7
@@
int strucmp(char *Str1, char *Str2)
* \fn int strpos(char *Str, char Ch)
* \brief Search a string for an ascii character
*/
* \fn int strpos(char *Str, char Ch)
* \brief Search a string for an ascii character
*/
-int strpos(char *Str, char Ch)
+int strpos(c
onst c
har *Str, char Ch)
{
int pos;
for(pos=0;Str[pos];pos++)
{
int pos;
for(pos=0;Str[pos];pos++)
@@
-104,7
+104,7
@@
int ByteSum(void *Ptr, int Size)
* \fn Uint strlen(char *__str)
* \brief Get the length of string
*/
* \fn Uint strlen(char *__str)
* \brief Get the length of string
*/
-Uint strlen(char *__str)
+Uint strlen(c
onst c
har *__str)
{
Uint ret = 0;
while(*__str++) ret++;
{
Uint ret = 0;
while(*__str++) ret++;
@@
-115,7
+115,7
@@
Uint strlen(char *__str)
* \fn char *strcpy(char *__str1, char *__str2)
* \brief Copy a string to a new location
*/
* \fn char *strcpy(char *__str1, char *__str2)
* \brief Copy a string to a new location
*/
-char *strcpy(char *__str1, char *__str2)
+char *strcpy(char *__str1, c
onst c
har *__str2)
{
while(*__str2)
*__str1++ = *__str2++;
{
while(*__str2)
*__str1++ = *__str2++;
@@
-128,7
+128,7
@@
char *strcpy(char *__str1, char *__str2)
* \brief Compare two strings return the difference between
* the first non-matching characters.
*/
* \brief Compare two strings return the difference between
* the first non-matching characters.
*/
-int strcmp(c
har *str1,
char *str2)
+int strcmp(c
onst char *str1, const
char *str2)
{
while(*str1 && *str1 == *str2)
str1++, str2++;
{
while(*str1 && *str1 == *str2)
str1++, str2++;
@@
-139,7
+139,7
@@
int strcmp(char *str1, char *str2)
* \fn int strncmp(char *Str1, char *Str2, size_t num)
* \brief Compare strings \a Str1 and \a Str2 to a maximum of \a num characters
*/
* \fn int strncmp(char *Str1, char *Str2, size_t num)
* \brief Compare strings \a Str1 and \a Str2 to a maximum of \a num characters
*/
-int strncmp(c
har *Str1,
char *Str2, size_t num)
+int strncmp(c
onst char *Str1, const
char *Str2, size_t num)
{
if(num == 0) return 0; // TODO: Check what should officially happen here
while(--num && *Str1 && *Str1 == *Str2)
{
if(num == 0) return 0; // TODO: Check what should officially happen here
while(--num && *Str1 && *Str1 == *Str2)
@@
-151,7
+151,7
@@
int strncmp(char *Str1, char *Str2, size_t num)
* \fn char *strdup(char *str)
* \brief Duplicates a string
*/
* \fn char *strdup(char *str)
* \brief Duplicates a string
*/
-char *strdup(char *str)
+char *strdup(c
onst c
har *str)
{
char *ret;
ret = malloc(strlen(str)+1);
{
char *ret;
ret = malloc(strlen(str)+1);
@@
-159,11
+159,22
@@
char *strdup(char *str)
return ret;
}
return ret;
}
+/**
+ * \fn int DivUp(int num, int dem)
+ * \brief Divide two numbers, rounding up
+ * \param num Numerator
+ * \param dem Denominator
+ */
+int DivUp(int num, int dem)
+{
+ return (num+dem-1)/dem;
+}
+
/**
* \fn int strpos8(char *str, Uint32 search)
* \brief Search a string for a UTF-8 character
*/
/**
* \fn int strpos8(char *str, Uint32 search)
* \brief Search a string for a UTF-8 character
*/
-int strpos8(char *str, Uint32 Search)
+int strpos8(c
onst c
har *str, Uint32 Search)
{
int pos;
Uint32 val = 0;
{
int pos;
Uint32 val = 0;
UCC
git Repository :: git.ucc.asn.au