Explorar el Código

Buildable faux's ctype and str

Serj Kalichev hace 4 años
padre
commit
07dcdfda2a
Se han modificado 3 ficheros con 11 adiciones y 26 borrados
  1. 0 1
      faux/ctype.h
  2. 7 21
      faux/str.h
  3. 4 4
      faux/str/str.c

+ 0 - 1
faux/ctype.h

@@ -8,7 +8,6 @@
 #include <ctype.h>
 
 #include "faux/types.h"
-#include "faux/c_decl.h"
 
 C_DECL_BEGIN
 

+ 7 - 21
faux/str.h

@@ -14,34 +14,20 @@ lub_string_free() to release the dynamically allocated memory.
 
 If a "const char *" is returned then the client has no responsiblity for releasing memory.
 */
-/*---------------------------------------------------------------
- * HISTORY
- * 7-Dec-2004		Graeme McKerrell	
- *    Updated to use the "lub" prefix
- * 6-Feb-2004		Graeme McKerrell	
- *    removed init_fn type definition and parameter, the client had
- *    more flexiblity in defining their own initialisation operation with
- *    arguments rather than use a "one-size-fits-all" approach.
- *    Modified blockpool structure to support FIFO block allocation.
- * 23-Jan-2004		Graeme McKerrell	
- *    Initial version
- *---------------------------------------------------------------
- * Copyright (C) 2004 3Com Corporation. All Rights Reserved.
- *--------------------------------------------------------------- */
-#ifndef _lub_string_h
-#define _lub_string_h
+
+#ifndef _faux_str_h
+#define _faux_str_h
 
 #include <stddef.h>
 
-#include "lub/c_decl.h"
-#include "lub/types.h"
+#include "faux/types.h"
 
 #define UTF8_MASK 0xC0
 #define UTF8_7BIT_MASK 0x80 /* One byte or multibyte */
 #define UTF8_11   0xC0 /* First UTF8 byte */
 #define UTF8_10   0x80 /* Next UTF8 bytes */
 
-_BEGIN_C_DECL
+C_DECL_BEGIN
 /**
  * This operation duplicates the specified string.
  *
@@ -274,6 +260,6 @@ const char *lub_string_nextword(const char *string,
 	size_t *len, size_t *offset, size_t *quoted);
 unsigned int lub_string_wordcount(const char *line);
 
-_END_C_DECL
-#endif				/* _lub_string_h */
+C_DECL_END
+#endif				/* _faux_str_h */
 /** @} */

+ 4 - 4
faux/str/str.c

@@ -187,8 +187,8 @@ int lub_string_nocasecmp(const char *cs, const char *ct)
 		 * MACRO implementation uses braces to prevent multiple increments
 		 * when called.
 		 */
-		int s = lub_ctype_tolower(*cs++);
-		int t = lub_ctype_tolower(*ct++);
+		int s = faux_ctype_tolower(*cs++);
+		int t = faux_ctype_tolower(*ct++);
 
 		result = s - t;
 	}
@@ -236,7 +236,7 @@ const char *lub_string_nocasestr(const char *cs, const char *ct)
 		 * (see above)
 		 */
 		while (*p && *q
-		       && (lub_ctype_tolower(*p) == lub_ctype_tolower(*q))) {
+		       && (faux_ctype_tolower(*p) == faux_ctype_tolower(*q))) {
 			p++, q++;
 		}
 		if (0 == *p) {
@@ -282,7 +282,7 @@ const char *lub_string_suffix(const char *string)
 	const char *p1, *p2;
 	p1 = p2 = string;
 	while (*p1) {
-		if (lub_ctype_isspace(*p1)) {
+		if (faux_ctype_isspace(*p1)) {
 			p2 = p1;
 			p2++;
 		}