[gegl] libs: Use strlen() instead of strnlen()



commit ca9f85494b5d003454ffd9d3d75349d49301775d
Author: Martin Nordholts <martinn src gnome org>
Date:   Sun Oct 3 08:22:55 2010 +0200

    libs: Use strlen() instead of strnlen()
    
    Use strlen() instead of the non-standard strnlen().

 libs/rgbe/rgbe.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/libs/rgbe/rgbe.c b/libs/rgbe/rgbe.c
index 0bdc5b7..d86163b 100644
--- a/libs/rgbe/rgbe.c
+++ b/libs/rgbe/rgbe.c
@@ -722,6 +722,7 @@ rgbe_header_write (const rgbe_header *header,
 {
   gchar    *line    = NULL;
   gboolean  success = FALSE;
+  gint      len;
 
   g_return_val_if_fail (header, FALSE);
   g_return_val_if_fail (f,      FALSE);
@@ -734,9 +735,8 @@ rgbe_header_write (const rgbe_header *header,
   /* Insert the package name as the software name if not present (zero len)
    * or we don't have a null terminated name length.
    */
-  if ( strnlen (header->software, RGBE_MAX_SOFTWARE_LEN) ==                0 ||
-      (strnlen (header->software, RGBE_MAX_SOFTWARE_LEN) == RGBE_MAX_SOFTWARE_LEN &&
-       header->software[RGBE_MAX_SOFTWARE_LEN - 1] != '\0'))
+  len = strlen (header->software);
+  if (len  == 0 || len > RGBE_MAX_SOFTWARE_LEN - 1)
     {
       line = g_strconcat ("SOFTWARE=", PACKAGE_STRING, "\n", NULL);
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]