Browse Source

Use xzalloc(sz) instead of xcalloc(1, sz)

* aux_children.c (register_aux_child_ex): Use xzalloc instead of xcalloc
of one-item-sized array.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Likewise.
* kvm.c (vcpu_alloc): Likewise.
* perf.c (fetch_perf_event_attr): Likewise.
* syscall.c (ptrace_get_scno): Likewise.
Eugene Syromyatnikov 9 months ago
parent
commit
683c556de4
5 changed files with 5 additions and 5 deletions
  1. 1
    1
      aux_children.c
  2. 1
    1
      bpf.c
  3. 1
    1
      kvm.c
  4. 1
    1
      perf.c
  5. 1
    1
      syscall.c

+ 1
- 1
aux_children.c View File

@@ -65,7 +65,7 @@ register_aux_child_ex(pid_t pid, const struct aux_child_handlers *h,
65 65
 			error_func_msg_and_die("Duplicate auxiliary child pid");
66 66
 	}
67 67
 
68
-	child = xcalloc(1, sizeof(*child));
68
+	child = xzalloc(sizeof(*child));
69 69
 
70 70
 	child->pid = pid;
71 71
 	child->handlers = h ?: &default_handlers;

+ 1
- 1
bpf.c View File

@@ -612,7 +612,7 @@ BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)
612 612
 	struct obj_get_info_saved *saved;
613 613
 
614 614
 	if (entering(tcp)) {
615
-		saved = xcalloc(1, sizeof(*saved));
615
+		saved = xzalloc(sizeof(*saved));
616 616
 		saved->info_len = attr.info_len;
617 617
 		set_tcb_priv_data(tcp, saved, free);
618 618
 

+ 1
- 1
kvm.c View File

@@ -44,7 +44,7 @@ vcpu_find(struct tcb *const tcp, int fd)
44 44
 static struct vcpu_info *
45 45
 vcpu_alloc(struct tcb *const tcp, int fd, int cpuid)
46 46
 {
47
-	struct vcpu_info *vcpu_info = xcalloc(1, sizeof(*vcpu_info));
47
+	struct vcpu_info *vcpu_info = xzalloc(sizeof(*vcpu_info));
48 48
 
49 49
 	vcpu_info->fd = fd;
50 50
 	vcpu_info->cpuid = cpuid;

+ 1
- 1
perf.c View File

@@ -74,7 +74,7 @@ fetch_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
74 74
 	/* Size should be multiple of 8, but kernel doesn't check for it */
75 75
 	/* size &= ~7; */
76 76
 
77
-	attr = xcalloc(1, sizeof(*attr));
77
+	attr = xzalloc(sizeof(*attr));
78 78
 
79 79
 	if (umoven_or_printaddr(tcp, addr, size, attr)) {
80 80
 		free(attr);

+ 1
- 1
syscall.c View File

@@ -1301,7 +1301,7 @@ get_scno(struct tcb *tcp)
1301 1301
 		tcp->s_ent = &sysent[tcp->scno];
1302 1302
 		tcp->qual_flg = qual_flags(tcp->scno);
1303 1303
 	} else {
1304
-		struct sysent_buf *s = xcalloc(1, sizeof(*s));
1304
+		struct sysent_buf *s = xzalloc(sizeof(*s));
1305 1305
 
1306 1306
 		s->tcp = tcp;
1307 1307
 		s->ent = stub_sysent;

Loading…
Cancel
Save