mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-30 01:20:21 +01:00
util: use xalloc instead of calloc to avoid NULL checks
This commit is contained in:
parent
bbc1f8de1c
commit
005c4ac493
2 changed files with 2 additions and 2 deletions
|
|
@ -54,7 +54,7 @@ xread_with_fds(int fd, void *buf, size_t count, int **fds)
|
|||
if (received > 0) {
|
||||
*fds = NULL;
|
||||
|
||||
_cleanup_free_ int *fd_return = calloc(MAX_FDS + 1, sizeof(int));
|
||||
_cleanup_free_ int *fd_return = xalloc(MAX_FDS + 1 * sizeof(int));
|
||||
size_t idx = 0;
|
||||
|
||||
for (struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) {
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ strreplace(const char *string, const char *separator, const char *replacement)
|
|||
|
||||
size_t rlen = strlen(replacement);
|
||||
size_t max = slen * max(rlen, 1);
|
||||
char *r = calloc(max + 1, 1); /* the result, one extra for terminating \0 */
|
||||
char *r = xalloc(max + 1); /* the result, one extra for terminating \0 */
|
||||
char *destptr = r;
|
||||
|
||||
while (next) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue