Dolda2000 GitWeb
/
doldaconnect.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9c161e7
)
Ported the qcmdqueue structure to the fnet-adc as well.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 26 Feb 2008 17:01:20 +0000
(18:01 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 26 Feb 2008 17:01:20 +0000
(18:01 +0100)
daemon/fnet-adc.c
patch
|
blob
|
blame
|
history
diff --git
a/daemon/fnet-adc.c
b/daemon/fnet-adc.c
index
5c609f8
..
19141a2
100644
(file)
--- a/
daemon/fnet-adc.c
+++ b/
daemon/fnet-adc.c
@@
-58,6
+58,11
@@
struct qcmd {
wchar_t **args;
};
wchar_t **args;
};
+struct qcmdqueue {
+ struct qcmd *f, *l;
+ int size;
+};
+
struct adchub {
struct socket *sk;
char *inbuf;
struct adchub {
struct socket *sk;
char *inbuf;
@@
-69,7
+74,7
@@
struct adchub {
iconv_t ich;
int state;
struct wcspair *hubinf;
iconv_t ich;
int state;
struct wcspair *hubinf;
- struct qcmd
*
queue;
+ struct qcmd
queue
queue;
};
static wchar_t *eoc;
};
static wchar_t *eoc;
@@
-163,26
+168,31
@@
static void sendadc(struct socket *sk, int sep, ...)
va_end(args);
}
va_end(args);
}
-static struct qcmd *newqcmd(struct qcmd
*
*queue, wchar_t **args)
+static struct qcmd *newqcmd(struct qcmd
queue
*queue, wchar_t **args)
{
struct qcmd *new;
{
struct qcmd *new;
- while(*queue != NULL)
- queue = &((*queue)->next);
new = smalloc(sizeof(*new));
new->next = NULL;
new->args = args;
new = smalloc(sizeof(*new));
new->next = NULL;
new->args = args;
- *queue = new;
+ if(queue->l == NULL)
+ queue->f = new;
+ else
+ queue->l->next = new;
+ queue->l = new;
+ queue->size++;
return(new);
}
return(new);
}
-static struct qcmd *ulqcmd(struct qcmd
*
*queue)
+static struct qcmd *ulqcmd(struct qcmd
queue
*queue)
{
struct qcmd *ret;
{
struct qcmd *ret;
- if((ret =
*queue
) == NULL)
+ if((ret =
queue->f
) == NULL)
return(NULL);
return(NULL);
- *queue = ret->next;
+ if((queue->f = ret->next) == NULL)
+ queue->l = NULL;
+ queue->size--;
return(ret);
}
return(ret);
}