(svn r1808) Use strcmp() instead of home brewed function str_eq()
authortron
Sat, 05 Feb 2005 22:50:33 +0000
changeset 1304 8570010abe7b
parent 1303 58bc18048f53
child 1305 ee656cd36baa
(svn r1808) Use strcmp() instead of home brewed function str_eq()
macros.h
misc.c
misc_gui.c
network_gui.c
players.c
town_cmd.c
--- a/macros.h	Sat Feb 05 22:25:07 2005 +0000
+++ b/macros.h	Sat Feb 05 22:50:33 2005 +0000
@@ -26,16 +26,6 @@
 static inline bool int32_add_overflow(int32 a, int32 b) { return (int32)(a^b)>=0 && (int32)(a^(a+b))<0; }
 static inline bool int32_sub_overflow(int32 a, int32 b) { return (int32)(a^b)<0 && (int32)(a^(a-b))<0; }
 
-static inline bool str_eq(const byte *a, const byte *b)
-{
-	int i=0;
-	while (a[i] == b[i]) {
-		if (a[i] == 0)
-			return true;
-		i++;
-	}
-	return false;
-}
 
 // Will crash if strings are equal
 static inline bool str_is_below(byte *a, byte *b) {
--- a/misc.c	Sat Feb 05 22:25:07 2005 +0000
+++ b/misc.c	Sat Feb 05 22:50:33 2005 +0000
@@ -352,7 +352,7 @@
 			if (free_item == -1)
 				free_item = i;
 		} else {
-			if (check_double && str_eq(names, name)) {
+			if (check_double && strcmp(names, name) == 0) {
 				_error_message = STR_0132_CHOSEN_NAME_IN_USE_ALREADY;
 				return 0;
 			}
--- a/misc_gui.c	Sat Feb 05 22:25:07 2005 +0000
+++ b/misc_gui.c	Sat Feb 05 22:50:33 2005 +0000
@@ -896,7 +896,8 @@
 		case 3: DeleteWindow(w); break;
 		case 4:
 press_ok:;
-			if (str_eq(WP(w,querystr_d).buf, WP(w,querystr_d).buf + MAX_QUERYSTR_LEN) && !_do_edit_on_text_even_when_no_change_to_edit_box) {
+			if (strcmp(WP(w,querystr_d).buf, WP(w,querystr_d).buf + MAX_QUERYSTR_LEN) == 0 &&
+					!_do_edit_on_text_even_when_no_change_to_edit_box) {
 				DeleteWindow(w);
 			} else {
 				byte *buf = WP(w,querystr_d).buf;
--- a/network_gui.c	Sat Feb 05 22:25:07 2005 +0000
+++ b/network_gui.c	Sat Feb 05 22:50:33 2005 +0000
@@ -1368,7 +1368,7 @@
 		case 3: DeleteWindow(w); break; // Cancel
 		case 2: // Send
 press_ok:;
-			if (str_eq(WP(w,querystr_d).buf, WP(w,querystr_d).buf + MAX_QUERYSTR_LEN)) {
+			if (strcmp(WP(w,querystr_d).buf, WP(w,querystr_d).buf + MAX_QUERYSTR_LEN) == 0) {
 				DeleteWindow(w);
 			} else {
 				byte *buf = WP(w,querystr_d).buf;
--- a/players.c	Sat Feb 05 22:25:07 2005 +0000
+++ b/players.c	Sat Feb 05 22:50:33 2005 +0000
@@ -436,7 +436,7 @@
 			if (pp->is_active && p != pp) {
 				SetDParam(0, pp->president_name_2);
 				GetString(buffer2, pp->president_name_1);
-				if (str_eq(buffer2, buffer))
+				if (strcmp(buffer2, buffer) == 0)
 					goto restart;
 			}
 		}
--- a/town_cmd.c	Sat Feb 05 22:25:07 2005 +0000
+++ b/town_cmd.c	Sat Feb 05 22:50:33 2005 +0000
@@ -879,7 +879,7 @@
 			if (t2->xy != 0) {
 				SetDParam(0, t2->townnameparts);
 				GetString(buf2, t2->townnametype);
-				if (str_eq(buf1, buf2))
+				if (strcmp(buf1, buf2) == 0)
 					goto restart;
 			}
 		}