Zero-copy FTP/HTTP Daemon compatible with all POSIX systems
| 1 | #include "pal_scratch.h" |
| 2 | #include <stdint.h> |
| 3 | |
| 4 | int main(void) |
| 5 | { |
| 6 | uint8_t *p1 = NULL; |
| 7 | uint8_t *p2 = NULL; |
| 8 | |
| 9 | if (pal_scratch_acquire(&p1, 16U) != 0) { |
| 10 | return 1; |
| 11 | } |
| 12 | if (p1 == NULL) { |
| 13 | return 2; |
| 14 | } |
| 15 | |
| 16 | if (pal_scratch_acquire(&p2, 16U) == 0) { |
| 17 | return 3; |
| 18 | } |
| 19 | |
| 20 | pal_scratch_release(p1); |
| 21 | |
| 22 | if (pal_scratch_acquire(&p2, 16U) != 0) { |
| 23 | return 4; |
| 24 | } |
| 25 | if (p2 == NULL) { |
| 26 | return 5; |
| 27 | } |
| 28 | pal_scratch_release(p2); |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 |