9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [patch] remove redundant memsets after emalloc9p in cifs
@ 2022-11-14 19:23 Arne Meyer
  2022-12-02 16:22 ` Arne Meyer
  0 siblings, 1 reply; 3+ messages in thread
From: Arne Meyer @ 2022-11-14 19:23 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 64 bytes --]

Found these while looking through /sys/src/cmd.

Greetings,
Arne

[-- Attachment #2: cifs.patch --]
[-- Type: application/octet-stream, Size: 2880 bytes --]

diff e5d29a2bd91951a24fccecd958416856cecef444 uncommitted
--- a/sys/src/cmd/cifs/auth.c
+++ b/sys/src/cmd/cifs/auth.c
@@ -55,7 +55,6 @@
 		sysfatal("cannot get key - %r");
 
 	ap = emalloc9p(sizeof(Auth));
-	memset(ap, 0, sizeof(ap));
 	ap->user = estrdup9p(up->user);
 	ap->windom = estrdup9p(windom);
 
@@ -87,7 +86,6 @@
 		sysfatal("bad response size");
 
 	ap = emalloc9p(sizeof(Auth));
-	memset(ap, 0, sizeof(ap));
 	ap->user = estrdup9p(user);
 	ap->windom = estrdup9p(windom);
 
--- a/sys/src/cmd/cifs/cifs.c
+++ b/sys/src/cmd/cifs/cifs.c
@@ -28,7 +28,6 @@
 	}
 
 	s = emalloc9p(sizeof(Session));
-	memset(s, 0, sizeof(Session));
 
 	s->fd = fd;
 	s->nbt = nbt;
@@ -76,7 +75,6 @@
 	}
 
 	p = emalloc9p(sizeof(Pkt) + MTU);
-	memset(p, 0, sizeof(Pkt) +MTU);
 
 	p->buf = (uchar *)p + sizeof(Pkt);
 	p->s = s;
--- a/sys/src/cmd/cifs/dfs.c
+++ b/sys/src/cmd/cifs/dfs.c
@@ -379,7 +379,6 @@
 		sysfatal("no memory: %r");
 
 	cp = emalloc9p(sizeof(Dfscache));
-	memset(cp, 0, sizeof(Dfscache));
 	cp->rtt = SINT_MAX;
 
 	if(redir1(s, unc, cp, 1) == -1){
--- a/sys/src/cmd/cifs/main.c
+++ b/sys/src/cmd/cifs/main.c
@@ -333,7 +333,6 @@
 	r->fid->qid = r->ofcall.qid;
 
 	a = r->fid->aux = emalloc9p(sizeof(Aux));
-	memset(a, 0, sizeof(Aux));
 	a->path = estrdup9p("/");
 	a->sp = nil;
 	a->fh = -1;
@@ -360,7 +359,6 @@
 
 	fid->aux = a;
 
-	memset(a, 0, sizeof(Aux));
 	a->sh = -1;
 	a->fh = -1;
 	a->sp = oa->sp;
--- a/sys/src/cmd/cifs/trans.c
+++ b/sys/src/cmd/cifs/trans.c
@@ -148,7 +148,6 @@
 
 	if(ngot == 0){
 		*ent = emalloc9p(sizeof(Share) * navail);
-		memset(*ent, 0, sizeof(Share) * navail);
 	}
 
 	q = *ent + ngot;
@@ -274,7 +273,6 @@
 
 	if(ngot == 0){
 		*sip = emalloc9p(sizeof(Sessinfo) * navail);
-		memset(*sip, 0, sizeof(Sessinfo) * navail);
 	}
 
 	q = *sip + ngot;
@@ -333,7 +331,6 @@
 	}
 
 	*nlp = emalloc9p(sizeof(Namelist) * navail);
-	memset(*nlp, 0, sizeof(Namelist) * navail);
 
 	q = *nlp + ngot;
 	while(ngot < navail && nret--){
@@ -389,7 +386,6 @@
 	}
 
 	*nlp = emalloc9p(sizeof(Namelist) * navail);
-	memset(*nlp, 0, sizeof(Namelist) * navail);
 
 	q = *nlp + ngot;
 	while(ngot < navail && nret--){
@@ -443,7 +439,6 @@
 	}
 
 	*nlp = emalloc9p(sizeof(Namelist) * navail);
-	memset(*nlp, 0, sizeof(Namelist) * navail);
 
 	q = *nlp + ngot;
 	while(ngot < navail && nret--){
@@ -502,7 +497,6 @@
 
 	if(ngot == 0){
 		*nlp = emalloc9p(sizeof(Namelist) * navail);
-		memset(*nlp, 0, sizeof(Namelist) * navail);
 	}
 	q = *nlp + ngot;
 	while(ngot < navail && nret--){
@@ -616,7 +610,6 @@
 	}
 
 	*si = emalloc9p(sizeof(Serverinfo) * navail);
-	memset(*si, 0, sizeof(Serverinfo) * navail);
 
 	q = *si;
 	for (; nret-- != 0 && ngot < navail; ngot++){
@@ -763,7 +756,6 @@
 
 	if(ngot == 0){
 		*fip = emalloc9p(sizeof(Fileinfo) * navail);
-		memset(*fip, 0, sizeof(Fileinfo) * navail);
 	}
 	q = *fip + ngot;
 	for(; nret-- && ngot < navail; ngot++){

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] [patch] remove redundant memsets after emalloc9p in cifs
  2022-11-14 19:23 [9front] [patch] remove redundant memsets after emalloc9p in cifs Arne Meyer
@ 2022-12-02 16:22 ` Arne Meyer
  2022-12-16 18:28   ` Arne Meyer
  0 siblings, 1 reply; 3+ messages in thread
From: Arne Meyer @ 2022-12-02 16:22 UTC (permalink / raw)
  To: 9front

ping
> Arne Meyer <meyer.arne83@netcologne.de> hat am 14.11.2022 19:23 GMT geschrieben:
> 
>  
> Found these while looking through /sys/src/cmd.
> 
> Greetings,
> Arne

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] [patch] remove redundant memsets after emalloc9p in cifs
  2022-12-02 16:22 ` Arne Meyer
@ 2022-12-16 18:28   ` Arne Meyer
  0 siblings, 0 replies; 3+ messages in thread
From: Arne Meyer @ 2022-12-16 18:28 UTC (permalink / raw)
  To: 9front

ping
> Arne Meyer <meyer.arne83@netcologne.de> hat am 02.12.2022 16:22 GMT geschrieben:
> 
>  
> ping
> > Arne Meyer <meyer.arne83@netcologne.de> hat am 14.11.2022 19:23 GMT geschrieben:
> > 
> >  
> > Found these while looking through /sys/src/cmd.
> > 
> > Greetings,
> > Arne

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-16 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 19:23 [9front] [patch] remove redundant memsets after emalloc9p in cifs Arne Meyer
2022-12-02 16:22 ` Arne Meyer
2022-12-16 18:28   ` Arne Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).