about summary refs log tree commit diff
path: root/intl
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2014-02-10 14:45:42 +0100
committerOndřej Bílka <neleai@seznam.cz>2014-02-10 15:07:12 +0100
commita1ffb40e32741f992c743e7b16c061fefa3747ac (patch)
tree246a29a87b26cfd5d07b17070f85eb3785018de9 /intl
parent1448f3244714a9dabb5240ec18b094f100887d5c (diff)
downloadglibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz
glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.xz
glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'intl')
-rw-r--r--intl/bindtextdom.c18
-rw-r--r--intl/dcigettext.c20
-rw-r--r--intl/loadmsgcat.c4
-rw-r--r--intl/localealias.c4
4 files changed, 23 insertions, 23 deletions
diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
index 20c37b2863..c3624961a8 100644
--- a/intl/bindtextdom.c
+++ b/intl/bindtextdom.c
@@ -158,12 +158,12 @@ set_binding_values (domainname, dirnamep, codesetp)
 #else
 		      size_t len = strlen (dirname) + 1;
 		      result = (char *) malloc (len);
-		      if (__builtin_expect (result != NULL, 1))
+		      if (__glibc_likely (result != NULL))
 			memcpy (result, dirname, len);
 #endif
 		    }
 
-		  if (__builtin_expect (result != NULL, 1))
+		  if (__glibc_likely (result != NULL))
 		    {
 		      if (binding->dirname != _nl_default_dirname)
 			free (binding->dirname);
@@ -196,11 +196,11 @@ set_binding_values (domainname, dirnamep, codesetp)
 #else
 		  size_t len = strlen (codeset) + 1;
 		  result = (char *) malloc (len);
-		  if (__builtin_expect (result != NULL, 1))
+		  if (__glibc_likely (result != NULL))
 		    memcpy (result, codeset, len);
 #endif
 
-		  if (__builtin_expect (result != NULL, 1))
+		  if (__glibc_likely (result != NULL))
 		    {
 		      free (binding->codeset);
 
@@ -228,7 +228,7 @@ set_binding_values (domainname, dirnamep, codesetp)
       struct binding *new_binding =
 	(struct binding *) malloc (offsetof (struct binding, domainname) + len);
 
-      if (__builtin_expect (new_binding == NULL, 0))
+      if (__glibc_unlikely (new_binding == NULL))
 	goto failed;
 
       memcpy (new_binding->domainname, domainname, len);
@@ -249,12 +249,12 @@ set_binding_values (domainname, dirnamep, codesetp)
 		  char *result;
 #if defined _LIBC || defined HAVE_STRDUP
 		  result = strdup (dirname);
-		  if (__builtin_expect (result == NULL, 0))
+		  if (__glibc_unlikely (result == NULL))
 		    goto failed_dirname;
 #else
 		  size_t len = strlen (dirname) + 1;
 		  result = (char *) malloc (len);
-		  if (__builtin_expect (result == NULL, 0))
+		  if (__glibc_unlikely (result == NULL))
 		    goto failed_dirname;
 		  memcpy (result, dirname, len);
 #endif
@@ -278,12 +278,12 @@ set_binding_values (domainname, dirnamep, codesetp)
 
 #if defined _LIBC || defined HAVE_STRDUP
 	      result = strdup (codeset);
-	      if (__builtin_expect (result == NULL, 0))
+	      if (__glibc_unlikely (result == NULL))
 		goto failed_codeset;
 #else
 	      size_t len = strlen (codeset) + 1;
 	      result = (char *) malloc (len);
-	      if (__builtin_expect (result == NULL, 0))
+	      if (__glibc_unlikely (result == NULL))
 		goto failed_codeset;
 	      memcpy (result, codeset, len);
 #endif
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index f3d97fb0be..723dd7ef46 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -640,7 +640,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
 
 		  /* Resource problems are not fatal, instead we return no
 		     translation.  */
-		  if (__builtin_expect (retval == (char *) -1, 0))
+		  if (__glibc_unlikely (retval == (char *) -1))
 		    goto no_translation;
 
 		  if (retval != NULL)
@@ -654,7 +654,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
 	  /* Returning -1 means that some resource problem exists
 	     (likely memory) and that the strings could not be
 	     converted.  Return the original strings.  */
-	  if (__builtin_expect (retval == (char *) -1, 0))
+	  if (__glibc_unlikely (retval == (char *) -1))
 	    goto no_translation;
 
 	  if (retval != NULL)
@@ -904,7 +904,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
 	    realloc (domain->conversions,
 		     (nconversions + 1) * sizeof (struct converted_domain));
 
-	  if (__builtin_expect (new_conversions == NULL, 0))
+	  if (__glibc_unlikely (new_conversions == NULL))
 	    {
 	      /* Nothing we can do, no more memory.  We cannot use the
 		 translation because it might be encoded incorrectly.  */
@@ -917,7 +917,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
 
 	  /* Copy the 'encoding' string to permanent storage.  */
 	  encoding = strdup (encoding);
-	  if (__builtin_expect (encoding == NULL, 0))
+	  if (__glibc_unlikely (encoding == NULL))
 	    /* Nothing we can do, no more memory.  We cannot use the
 	       translation because it might be encoded incorrectly.  */
 	    goto unlock_fail;
@@ -948,7 +948,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
 
 	    /* Resource problems are fatal.  If we continue onwards we will
 	       only attempt to calloc a new conv_tab and fail later.  */
-	    if (__builtin_expect (nullentry == (char *) -1, 0))
+	    if (__glibc_unlikely (nullentry == (char *) -1))
 	      return (char *) -1;
 
 	    if (nullentry != NULL)
@@ -981,12 +981,12 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
 		    charset = norm_add_slashes (charset, "");
 		    int r = __gconv_open (outcharset, charset, &convd->conv,
 					  GCONV_AVOID_NOCONV);
-		    if (__builtin_expect (r != __GCONV_OK, 0))
+		    if (__glibc_unlikely (r != __GCONV_OK))
 		      {
 			/* If the output encoding is the same there is
 			   nothing to do.  Otherwise do not use the
 			   translation at all.  */
-			if (__builtin_expect (r != __GCONV_NULCONV, 1))
+			if (__glibc_likely (r != __GCONV_NULCONV))
 			  {
 			    __libc_rwlock_unlock (domain->conversions_lock);
 			    free ((char *) encoding);
@@ -1053,7 +1053,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
 	     handle this case by converting RESULTLEN bytes, including
 	     NULs.  */
 
-	  if (__builtin_expect (convd->conv_tab == NULL, 0))
+	  if (__glibc_unlikely (convd->conv_tab == NULL))
 	    {
 	      __libc_lock_lock (lock);
 	      if (convd->conv_tab == NULL)
@@ -1069,7 +1069,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
 	      __libc_lock_unlock (lock);
 	    }
 
-	  if (__builtin_expect (convd->conv_tab == (char **) -1, 0))
+	  if (__glibc_unlikely (convd->conv_tab == (char **) -1))
 	    /* Nothing we can do, no more memory.  We cannot use the
 	       translation because it might be encoded incorrectly.  */
 	    return (char *) -1;
@@ -1190,7 +1190,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
 		      /* Fall through and return -1.  */
 # endif
 		    }
-		  if (__builtin_expect (newmem == NULL, 0))
+		  if (__glibc_unlikely (newmem == NULL))
 		    {
 		      freemem = NULL;
 		      freemem_size = 0;
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index 18bd501139..b96a997819 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -829,7 +829,7 @@ _nl_load_domain (domain_file, domainbinding)
   data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
 					 MAP_PRIVATE, fd, 0);
 
-  if (__builtin_expect (data != MAP_FAILED, 1))
+  if (__glibc_likely (data != MAP_FAILED))
     {
       /* mmap() call was successful.  */
       close (fd);
@@ -1257,7 +1257,7 @@ _nl_load_domain (domain_file, domainbinding)
 
   /* Get the header entry and look for a plural specification.  */
   nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
-  if (__builtin_expect (nullentry == (char *) -1, 0))
+  if (__glibc_unlikely (nullentry == (char *) -1))
     {
       __libc_rwlock_fini (domain->conversions_lock);
       goto invalid;
diff --git a/intl/localealias.c b/intl/localealias.c
index ef826c0dc9..9ab432885b 100644
--- a/intl/localealias.c
+++ b/intl/localealias.c
@@ -293,7 +293,7 @@ read_alias_file (fname, fname_len)
 		*cp++ = '\0';
 
 	      if (nmap >= maxmap)
-		if (__builtin_expect (extend_alias_table (), 0))
+		if (__glibc_unlikely (extend_alias_table ()))
 		  goto out;
 
 	      alias_len = strlen (alias) + 1;
@@ -309,7 +309,7 @@ read_alias_file (fname, fname_len)
 		  if (new_pool == NULL)
 		    goto out;
 
-		  if (__builtin_expect (string_space != new_pool, 0))
+		  if (__glibc_unlikely (string_space != new_pool))
 		    {
 		      size_t i;