[glib: 2/4] glocalfileinfo: Avoid getting unused type values




commit b1d4b4bb3bd2d19a885675a09be834a93c6a95d5
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Oct 11 14:24:17 2022 +0200

    glocalfileinfo: Avoid getting unused type values

 gio/glocalfileinfo.c | 37 +++++++++++--------------------------
 1 file changed, 11 insertions(+), 26 deletions(-)
---
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 64930ef31c..ecbc629c6b 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -2690,8 +2690,6 @@ set_mtime_atime (char                       *filename,
 {
   int res;
   guint64 val = 0;
-  guint32 val_usec = 0;
-  guint32 val_nsec = 0;
   struct stat statbuf;
   gboolean got_stat = FALSE;
 #ifdef HAVE_UTIMENSAT
@@ -2715,15 +2713,11 @@ set_mtime_atime (char                       *filename,
 #endif
        }
     }
-  
-  if (atime_usec_value)
-    {
-      if (!get_uint32 (atime_usec_value, &val_usec, error))
-       return FALSE;
-    }
 
   if (atime_nsec_value)
     {
+      guint32 val_nsec = 0;
+
       if (!get_uint32 (atime_nsec_value, &val_nsec, error))
         return FALSE;
       times_n[0].tv_nsec = val_nsec;
@@ -2747,14 +2741,11 @@ set_mtime_atime (char                       *filename,
 #endif
        }
     }
-  
-  if (mtime_usec_value)
-    {
-      if (!get_uint32 (mtime_usec_value, &val_usec, error))
-       return FALSE;
-    }
+
   if (mtime_nsec_value)
     {
+      guint32 val_nsec = 0;
+
       if (!get_uint32 (mtime_nsec_value, &val_nsec, error))
         return FALSE;
       times_n[1].tv_nsec = val_nsec;
@@ -2789,15 +2780,12 @@ set_mtime_atime (char                       *filename,
 
   if (atime_usec_value)
     {
+      guint32 val_usec = 0;
+
       if (!get_uint32 (atime_usec_value, &val_usec, error))
         return FALSE;
-      times[0].tv_usec = val_usec;
-    }
 
-  if (atime_nsec_value)
-    {
-      if (!get_uint32 (atime_nsec_value, &val_nsec, error))
-        return FALSE;
+      times[0].tv_usec = val_usec;
     }
 
   /* MTIME */
@@ -2823,15 +2811,12 @@ set_mtime_atime (char                       *filename,
 
   if (mtime_usec_value)
     {
+      guint32 val_usec = 0;
+
       if (!get_uint32 (mtime_usec_value, &val_usec, error))
         return FALSE;
-      times[1].tv_usec = val_usec;
-    }
 
-  if (mtime_nsec_value)
-    {
-      if (!get_uint32 (mtime_nsec_value, &val_nsec, error))
-        return FALSE;
+      times[1].tv_usec = val_usec;
     }
 
   res = utimes (filename, times);


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