@@ -927,30 +927,30 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
927927 char buffer [128 ];
928928 while (fgets (buffer , 128 , file )) {
929929
930- #define tryRead (label , variable ) (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %32llu kB", variable))
930+ #define tryRead (label , variable ) do { if (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %32llu kB", variable)) { break; } } while(0 )
931931 switch (buffer [0 ]) {
932932 case 'M' :
933- if ( tryRead ("MemTotal:" , & this -> totalMem )) {}
934- else if ( tryRead ("MemFree:" , & this -> freeMem )) {}
935- else if ( tryRead ("MemShared:" , & this -> sharedMem )) {}
933+ tryRead ("MemTotal:" , & this -> totalMem );
934+ tryRead ("MemFree:" , & this -> freeMem );
935+ tryRead ("MemShared:" , & this -> sharedMem );
936936 break ;
937937 case 'B' :
938- if ( tryRead ("Buffers:" , & this -> buffersMem )) {}
938+ tryRead ("Buffers:" , & this -> buffersMem );
939939 break ;
940940 case 'C' :
941- if ( tryRead ("Cached:" , & this -> cachedMem )) {}
941+ tryRead ("Cached:" , & this -> cachedMem );
942942 break ;
943943 case 'S' :
944944 switch (buffer [1 ]) {
945945 case 'w' :
946- if ( tryRead ("SwapTotal:" , & this -> totalSwap )) {}
947- else if ( tryRead ("SwapFree:" , & swapFree )) {}
946+ tryRead ("SwapTotal:" , & this -> totalSwap );
947+ tryRead ("SwapFree:" , & swapFree );
948948 break ;
949949 case 'h' :
950- if ( tryRead ("Shmem:" , & shmem )) {}
950+ tryRead ("Shmem:" , & shmem );
951951 break ;
952952 case 'R' :
953- if ( tryRead ("SReclaimable:" , & sreclaimable )) {}
953+ tryRead ("SReclaimable:" , & sreclaimable );
954954 break ;
955955 }
956956 break ;
0 commit comments