]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ipc/ipc_table.h
xnu-344.23.tar.gz
[apple/xnu.git] / osfmk / ipc / ipc_table.h
index 0fe414ca9137652f4cad355c9fb2b1374bffb827..16a02b3038f71c992dba18012bff61f0d13ef838 100644 (file)
@@ -199,14 +199,15 @@ extern void ipc_table_free(
        vm_size_t       size,
        vm_offset_t     table);
 
+#define it_entries_reallocable(its)                                    \
+       ((its)->its_size * sizeof(struct ipc_entry) >= PAGE_SIZE)
+
 #define        it_entries_alloc(its)                                           \
        ((ipc_entry_t)                                                  \
-        ipc_table_alloc(round_page(                                    \
-       (its)->its_size * sizeof(struct ipc_entry))))
-
-#define it_entries_reallocable(its)                                    \
-       ((its)->its_size * sizeof(struct ipc_entry)                     \
-       >= PAGE_SIZE)
+       ipc_table_alloc(it_entries_reallocable(its) ?                   \
+           round_page((its)->its_size * sizeof(struct ipc_entry)) :    \
+           (its)->its_size * sizeof(struct ipc_entry)                  \
+       ))
 
 #define        it_entries_realloc(its, table, nits)                            \
        ((ipc_entry_t)                                                  \
@@ -217,8 +218,9 @@ extern void ipc_table_free(
        ))
 
 #define        it_entries_free(its, table)                                     \
-       ipc_table_free(                                                 \
-           round_page((its)->its_size * sizeof(struct ipc_entry)),     \
+       ipc_table_free(it_entries_reallocable(its) ?                    \
+           round_page((its)->its_size * sizeof(struct ipc_entry)) :    \
+           (its)->its_size * sizeof(struct ipc_entry),                 \
            (vm_offset_t)(table)                                        \
        )