tPedantic strdup. - git-restrict - simple utility for git repo permission management
HTML git clone https://git.parazyd.org/git-restrict
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 5a927d1094dab529f8d1f02ee5104ed7155e12b4
DIR parent bfb37f5b2e763a5e764f9c6d808339cf4fac7040
HTML Author: Quentin Rameau <quinq@fifth.space>
Date: Sun, 22 May 2022 14:51:50 +0200
Pedantic strdup.
Diffstat:
M git-restrict.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
DIR diff --git a/git-restrict.c b/git-restrict.c
t@@ -27,10 +27,10 @@ static void die(const char *msg)
static char *strdup(const char *s)
{
- size_t l = strlen(s);
- char *d = malloc(l+1);
+ size_t sz = strlen(s)+1;
+ char *d = malloc(sz);
if (!d) return NULL;
- return memcpy(d, s, l+1);
+ return memcpy(d, s, sz);
}
int main(int argc, char *argv[])