C is Evil: Minor Edits
parent
8b51720358
commit
7a89327591
|
|
@ -31,12 +31,12 @@ When you dig into File Pilot, you’ll find its author wrote the entire thing in
|
||||||
Abner pokes fun at Rustaceans too. For example while extending [microui](https://github.com/rxi/microui) to support growable command lists (to queue up more draw commands per frame) he went straight for the jugular:
|
Abner pokes fun at Rustaceans too. For example while extending [microui](https://github.com/rxi/microui) to support growable command lists (to queue up more draw commands per frame) he went straight for the jugular:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
function __attribute__((nonnull)) void mu_grow_command_list(mu_Context *ctx, int capacity) {
|
function void mu_grow_command_list(mu_Context *ctx, int capacity) __attribute__((nonnull)) {
|
||||||
expect(capacity > ctx->command_list.capacity);
|
expect(capacity > ctx->command_list.capacity);
|
||||||
|
|
||||||
char *old_base = ctx->command_list.items;
|
char *old_base = ctx->command_list.items;
|
||||||
|
|
||||||
ctx->command_list.items = TC_REALLOC(ctx->command_list.items, capacity);
|
ctx->command_list.items = REALLOC(ctx->command_list.items, capacity);
|
||||||
ctx->command_list.capacity = capacity;
|
ctx->command_list.capacity = capacity;
|
||||||
|
|
||||||
/* patch up pointers (Rust enthusiasts: avert your eyes!) */
|
/* patch up pointers (Rust enthusiasts: avert your eyes!) */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue