Forráskód Böngészése

Merge remote-tracking branch 'upstream/master'

Leon Urbas 11 éve
szülő
commit
f8eb84a622
1 módosított fájl, 5 hozzáadás és 4 törlés
  1. 5 4
      src/ua_namespace.c

+ 5 - 4
src/ua_namespace.c

@@ -431,11 +431,12 @@ static UA_Int32 expand (namespace *ns) {
 	int32_t count = ns->count;
 
 	/* Resize only when table after removal of unused elements is either too full or too empty.  */
-	if (count * 2 > osize || (count * 8 < osize && osize > 32)) {
-		nindex = higher_prime_index (count * 2);
-		nsize = prime_tab[nindex].prime;
+	if (count * 2 < osize && (count * 8 > osize || osize <= 32)) {
+		return UA_SUCCESS;
 	}
-	return UA_SUCCESS;
+	
+	nindex = higher_prime_index (count * 2);
+	nsize = prime_tab[nindex].prime;
 
 	if (UA_alloc((void *)nentries, sizeof(ns_entry)*nsize) != UA_SUCCESS)
 		return UA_ERR_NO_MEMORY;