Explorar o código

Kernel+LibC: Pack SC_stat_params struct tighter

Flagged by pvs-studio, ordering the members from largest to smallest
allows us to save a few bytes in the size of the struct.
Brian Gianforcaro %!s(int64=3) %!d(string=hai) anos
pai
achega
07b314e843
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      Kernel/API/Syscall.h
  2. 1 1
      Userland/Libraries/LibC/stat.cpp

+ 1 - 1
Kernel/API/Syscall.h

@@ -450,9 +450,9 @@ struct SC_waitid_params {
 };
 
 struct SC_stat_params {
-    int dirfd;
     StringArgument path;
     struct stat* statbuf;
+    int dirfd;
     int follow_symlinks;
 };
 

+ 1 - 1
Userland/Libraries/LibC/stat.cpp

@@ -57,7 +57,7 @@ static int do_stat(int dirfd, const char* path, struct stat* statbuf, bool follo
         errno = EFAULT;
         return -1;
     }
-    Syscall::SC_stat_params params { dirfd, { path, strlen(path) }, statbuf, follow_symlinks };
+    Syscall::SC_stat_params params { { path, strlen(path) }, statbuf, dirfd, follow_symlinks };
     int rc = syscall(SC_stat, &params);
     __RETURN_WITH_ERRNO(rc, rc, -1);
 }