MCPcopy Create free account
hub / github.com/GJDuck/e9patch / malloc_rotate_right

Function malloc_rotate_right

examples/stdlib.c:1867–1886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1865}
1866
1867static void malloc_rotate_right(struct malloc_pool_s *pool, uint32_t n)
1868{
1869 uint32_t tmp = MA_LEFT(pool, n);
1870 if ((MA_LEFT(pool, n) = MA_RIGHT(pool, tmp)) != MA_NIL)
1871 MA_PARENT(pool, MA_RIGHT(pool, tmp)) = n;
1872 malloc_fix_invariant(pool, n);
1873 if ((MA_PARENT(pool, tmp) = MA_PARENT(pool, n)) != MA_NIL)
1874 {
1875 if (n == MA_LEFT(pool, MA_PARENT(pool, n)))
1876 MA_LEFT(pool, MA_PARENT(pool, n)) = tmp;
1877 else
1878 MA_RIGHT(pool, MA_PARENT(pool, n)) = tmp;
1879 } else
1880 pool->root = tmp;
1881 MA_RIGHT(pool, tmp) = n;
1882 MA_PARENT(pool, n) = tmp;
1883 malloc_fix_invariant(pool, tmp);
1884 if (MA_PARENT(pool, tmp) != MA_NIL)
1885 malloc_fix_invariant(pool, MA_PARENT(pool, tmp));
1886}
1887
1888static void malloc_rebalance_insert(struct malloc_pool_s *pool, uint32_t n)
1889{

Callers 2

malloc_rebalance_insertFunction · 0.85
malloc_rebalance_removeFunction · 0.85

Calls 1

malloc_fix_invariantFunction · 0.85

Tested by

no test coverage detected