diff options
| author | @syxhe <https://t.me/syxhe> | 2025-04-21 21:26:23 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2025-04-21 21:26:23 -0500 |
| commit | 521e9a2fc8e0ef1dffe4e590d0d4f65292f0d1df (patch) | |
| tree | b85e149b645dcdaa4ef2a7345a4898c39a683f8d /src/ll.c | |
| parent | 9cf4667331b97f1123f4156273a46558e27c2d2d (diff) | |
Implement a Concurrent Queue
Diffstat (limited to 'src/ll.c')
| -rw-r--r-- | src/ll.c | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -196,4 +196,16 @@ int dlinkedlist_foreach(dlinkedlist *ll, int (*callback)(void*)) { | |||
| 196 | callback(p->data); | 196 | callback(p->data); |
| 197 | 197 | ||
| 198 | return 0; | 198 | return 0; |
| 199 | } | ||
| 200 | |||
| 201 | void * dlinkedlist_poplast(dlinkedlist *ll) { | ||
| 202 | if(!ll) | ||
| 203 | RETURNWERR(EINVAL, NULL); | ||
| 204 | if(dlinkedlist_isempty(ll)) | ||
| 205 | RETURNWERR(ENODATA, NULL); | ||
| 206 | |||
| 207 | void *data = dlinkedlist_get(ll, ll->size - 1); | ||
| 208 | dlinkedlist_remove(ll, ll->size - 1); | ||
| 209 | |||
| 210 | return data; | ||
| 199 | } \ No newline at end of file | 211 | } \ No newline at end of file |
