libthread: get rid of chaninit() (thanks qrstuv)

chaninit() does not initialize Chan.qentry and Chan.nentry
and there is no way to get rid of such a channel. nobody is
using it, so removing the function to avoid confusion.
This commit is contained in:
cinap_lenrek 2015-03-04 10:20:31 +01:00
parent eaf91d0f8e
commit 07c7fa6716
3 changed files with 2 additions and 24 deletions

View file

@ -63,7 +63,6 @@ int alt(Alt alts[]);
int chanclose(Channel*);
int chanclosing(Channel *c);
Channel*chancreate(int elemsize, int bufsize);
int chaninit(Channel *c, int elemsize, int elemcnt);
void chanfree(Channel *c);
int chanprint(Channel *, char *, ...);
long decref(Ref *r); /* returns 0 iff value is now zero */

View file

@ -4,7 +4,6 @@ alt,
chanclose,
chancreate,
chanfree,
chaninit,
chanclosing,
chanprint,
mainstacksize,
@ -107,7 +106,6 @@ char* threadgetname(void)
void** threaddata(void)
void** procdata(void)
.XX
int chaninit(Channel *c, int elsize, int nel)
Channel* chancreate(int elsize, int nel)
void chanfree(Channel *c)
.XX
@ -384,10 +382,8 @@ operation blocks until the corresponding
.I recv
operation occurs and
.IR "vice versa" .
.I Chaninit
initializes a
.B Channel
for messages of size
.I Chancreate
allocates a new channel for messages of size
.I elsize
and with a buffer holding
.I nel
@ -395,8 +391,6 @@ messages.
If
.I nel
is zero, the channel is unbuffered.
.IR Chancreate
allocates a new channel and initializes it.
.I Chanfree
frees a channel that is no longer used.
.I Chanfree

View file

@ -49,21 +49,6 @@ chanfree(Channel *c)
unlock(&chanlock);
}
int
chaninit(Channel *c, int elemsize, int elemcnt)
{
if(elemcnt < 0 || elemsize <= 0 || c == nil)
return -1;
c->f = 0;
c->n = 0;
c->closed = 0;
c->freed = 0;
c->e = elemsize;
c->s = elemcnt;
_threaddebug(DBGCHAN, "chaninit %p", c);
return 1;
}
Channel*
chancreate(int elemsize, int elemcnt)
{