Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
LSH
lsh
Commits
5329136b
Commit
5329136b
authored
Jan 04, 1999
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* alist.c (alist_addv): New function.
(alist_add): -"- Rev: src/alist.c:1.15
parent
94daaa60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
12 deletions
+45
-12
src/alist.c
src/alist.c
+45
-12
No files found.
src/alist.c
View file @
5329136b
...
...
@@ -24,19 +24,48 @@
*/
#include <assert.h>
#include <stdarg.h>
#include "alist.h"
#include "atoms.h"
#include "werror.h"
#include "xalloc.h"
#include <assert.h>
#define CLASS_DEFINE
#include "alist.h.x"
#undef CLASS_DEFINE
struct
alist
*
alist_addv
(
struct
alist
*
a
,
unsigned
n
,
va_list
args
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
int
atom
=
va_arg
(
args
,
int
);
struct
lsh_object
*
value
=
va_arg
(
args
,
struct
lsh_object
*
);
if
(
atom
<
0
)
fatal
(
"Internal error!
\n
"
);
ALIST_SET
(
a
,
atom
,
value
);
}
assert
(
va_arg
(
args
,
int
)
==
-
1
);
return
a
;
}
struct
alist
*
alist_add
(
struct
alist
*
a
,
unsigned
n
,
...)
{
va_list
args
;
va_start
(
args
,
n
);
alist_addv
(
a
,
n
,
args
);
va_end
(
args
);
return
a
;
}
struct
alist_node
{
struct
alist_node
*
next
;
...
...
@@ -93,7 +122,7 @@ static void do_linear_set(struct alist *c, int atom, void *value)
self
->
table
[
atom
]
=
value
;
}
struct
alist
*
make_linear_alist
(
int
n
,
...)
struct
alist
*
make_linear_alist
(
unsigned
n
,
...)
{
int
i
;
va_list
args
;
...
...
@@ -106,7 +135,8 @@ struct alist *make_linear_alist(int n, ...)
res
->
table
[
i
]
=
NULL
;
va_start
(
args
,
n
);
#if 0
for (i=0; i<n; i++)
{
int atom = va_arg(args, int);
...
...
@@ -119,7 +149,11 @@ struct alist *make_linear_alist(int n, ...)
}
assert(va_arg(args, int) == -1);
#endif
alist_addv
(
&
res
->
super
,
n
,
args
);
va_end
(
args
);
return
&
res
->
super
;
}
...
...
@@ -215,9 +249,8 @@ static void do_linked_set(struct alist *c, int atom, void *value)
}
}
struct
alist
*
make_linked_alist
(
int
n
,
...)
struct
alist
*
make_linked_alist
(
unsigned
n
,
...)
{
int
i
;
va_list
args
;
struct
alist
*
res
;
...
...
@@ -231,6 +264,7 @@ struct alist *make_linked_alist(int n, ...)
va_start
(
args
,
n
);
#if 0
for (i=0; i<n; i++)
{
int atom = va_arg(args, int);
...
...
@@ -242,12 +276,11 @@ struct alist *make_linked_alist(int n, ...)
}
assert(va_arg(args, int) == -1);
#if 0
res->get = do_linked_get;
res->set = do_linked_set;
#endif
alist_addv
(
res
,
n
,
args
);
va_end
(
args
);
return
res
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment