From f3b33dd62d3aa920ee66270d1bef90c20e53168f Mon Sep 17 00:00:00 2001
From: Martin Nilsson <nilsson@opera.com>
Date: Mon, 3 Jun 2013 00:43:44 +0200
Subject: [PATCH] A but more compact logic code.

---
 src/stralloc.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/stralloc.c b/src/stralloc.c
index 1583439528..0b7dd79781 100644
--- a/src/stralloc.c
+++ b/src/stralloc.c
@@ -2063,19 +2063,13 @@ PMOD_EXPORT void set_flags_for_add( struct pike_string *ret,
   else
     ret->flags &= ~STRING_CONTENT_CHECKED;
 
-  if( (aflags & STRING_IS_LOWERCASE) && (b->flags & STRING_IS_LOWERCASE) )
-    ret->flags |= STRING_IS_LOWERCASE;
-  else
-    ret->flags &= ~STRING_IS_LOWERCASE;
-
-  if( (aflags & STRING_IS_UPPERCASE) && (b->flags & STRING_IS_UPPERCASE) )
-    ret->flags |= STRING_IS_UPPERCASE;
-  else
-    ret->flags &= ~STRING_IS_UPPERCASE;
+  ret->flags = ~(STRING_IS_LOWERCASE | STRING_IS_UPPERCASE) |
+    (aflags & b->flags);
 }
 
 PMOD_EXPORT void update_flags_for_add( struct pike_string *a, struct pike_string *b)
 {
+  int foo=0;
   if( !b->len ) return;
   if( a->flags & STRING_CONTENT_CHECKED )
   {
@@ -2088,12 +2082,7 @@ PMOD_EXPORT void update_flags_for_add( struct pike_string *a, struct pike_string
       a->flags &= ~STRING_CONTENT_CHECKED;
   }
 
-  if( (a->flags & STRING_IS_LOWERCASE) && !(b->flags & STRING_IS_LOWERCASE) )
-    a->flags &= ~STRING_IS_LOWERCASE;
-
-  if( (a->flags & STRING_IS_UPPERCASE) && !(b->flags & STRING_IS_UPPERCASE) )
-    a->flags &= ~STRING_IS_UPPERCASE;
-
+  a->flags &= ~(STRING_IS_LOWERCASE | STRING_IS_UPPERCASE) | b->flags;
 }
 
 /*** Add strings ***/
-- 
GitLab