Browse Source

libobs/util: Fix build on FreeBSD

FreeBSD already implemented os_get_free_size.  Move the new Linux
implementation into the existing not-__FreeBSD__ block.

Fixes: 935613816fd8 ("libobs/util: Update `os_get_free_size()`")
Ed Maste 5 months ago
parent
commit
6204c22853
1 changed files with 14 additions and 13 deletions
  1. 14 13
      libobs/util/platform-nix.c

+ 14 - 13
libobs/util/platform-nix.c

@@ -1087,6 +1087,20 @@ uint64_t os_get_proc_virtual_size(void)
 		return 0;
 	return (uint64_t)statm.virtual_size;
 }
+
+uint64_t os_get_sys_free_size(void)
+{
+	uint64_t free_memory = 0;
+#ifndef __OpenBSD__
+	struct sysinfo info;
+	if (sysinfo(&info) < 0)
+		return 0;
+
+	free_memory = ((uint64_t)info.freeram + (uint64_t)info.bufferram) * info.mem_unit;
+#endif
+
+	return free_memory;
+}
 #endif
 
 static uint64_t total_memory = 0;
@@ -1113,19 +1127,6 @@ uint64_t os_get_sys_total_size(void)
 	return total_memory;
 }
 
-uint64_t os_get_sys_free_size(void)
-{
-	uint64_t free_memory = 0;
-#ifndef __OpenBSD__
-	struct sysinfo info;
-	if (sysinfo(&info) < 0)
-		return 0;
-
-	free_memory = ((uint64_t)info.freeram + (uint64_t)info.bufferram) * info.mem_unit;
-#endif
-
-	return free_memory;
-}
 #endif
 
 #ifndef __APPLE__