Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
0cde283c
Commit
0cde283c
authored
26 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
fixed to export the definition of 'struct keypair'
Rev: src/mapping.c:1.33 Rev: src/mapping.h:1.12
parent
5e1a8282
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mapping.c
+15
-22
15 additions, 22 deletions
src/mapping.c
src/mapping.h
+8
-2
8 additions, 2 deletions
src/mapping.h
with
23 additions
and
24 deletions
src/mapping.c
+
15
−
22
View file @
0cde283c
...
...
@@ -4,7 +4,7 @@
||| See the files COPYING and DISCLAIMER for more information.
\*/
#include
"global.h"
RCSID
(
"$Id: mapping.c,v 1.3
2
1998/05/1
3 00:24
:2
9
hubbe Exp $"
);
RCSID
(
"$Id: mapping.c,v 1.3
3
1998/05/1
4 21:45
:2
1
hubbe Exp $"
);
#include
"main.h"
#include
"object.h"
#include
"mapping.h"
...
...
@@ -23,13 +23,6 @@ RCSID("$Id: mapping.c,v 1.32 1998/05/13 00:24:29 hubbe Exp $");
#define AVG_LINK_LENGTH 4
#define MIN_LINK_LENGTH 1
#define MAP_SLOTS(X) ((X)?((X)+((X)>>4)+8):0)
#define LOOP(m) for(e=0;e<m->hashsize;e++) for(k=m->hash[e];k;k=k->next)
struct
keypair
{
struct
keypair
*
next
;
struct
svalue
ind
,
val
;
};
struct
mapping
*
first_mapping
;
...
...
@@ -46,7 +39,7 @@ static void check_mapping_type_fields(struct mapping *m)
ind_types
=
val_types
=
0
;
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
{
val_types
|=
1
<<
k
->
val
.
type
;
ind_types
|=
1
<<
k
->
ind
.
type
;
...
...
@@ -137,7 +130,7 @@ void really_free_mapping(struct mapping *m)
fatal
(
"really free mapping on mapping with nonzero refs.
\n
"
);
#endif
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
{
free_svalue
(
&
k
->
val
);
free_svalue
(
&
k
->
ind
);
...
...
@@ -229,7 +222,7 @@ void mapping_fix_type_field(struct mapping *m)
val_types
=
ind_types
=
0
;
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
{
val_types
|=
1
<<
k
->
val
.
type
;
ind_types
|=
1
<<
k
->
ind
.
type
;
...
...
@@ -543,7 +536,7 @@ struct array *mapping_indices(struct mapping *m)
a
=
allocate_array
(
m
->
size
);
s
=
ITEM
(
a
);
LOOP
(
m
)
assign_svalue
(
s
++
,
&
k
->
ind
);
MAPPING_
LOOP
(
m
)
assign_svalue
(
s
++
,
&
k
->
ind
);
a
->
type_field
=
m
->
ind_types
;
...
...
@@ -564,7 +557,7 @@ struct array *mapping_values(struct mapping *m)
a
=
allocate_array
(
m
->
size
);
s
=
ITEM
(
a
);
LOOP
(
m
)
assign_svalue
(
s
++
,
&
k
->
val
);
MAPPING_
LOOP
(
m
)
assign_svalue
(
s
++
,
&
k
->
val
);
a
->
type_field
=
m
->
val_types
;
...
...
@@ -583,7 +576,7 @@ struct array *mapping_to_array(struct mapping *m)
struct
svalue
*
s
;
a
=
allocate_array
(
m
->
size
);
s
=
ITEM
(
a
);
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
{
struct
array
*
b
=
allocate_array
(
2
);
assign_svalue
(
b
->
item
+
0
,
&
k
->
ind
);
...
...
@@ -602,7 +595,7 @@ void mapping_replace(struct mapping *m,struct svalue *from, struct svalue *to)
INT32
e
;
struct
keypair
*
k
;
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
if
(
is_eq
(
&
k
->
val
,
from
))
assign_svalue
(
&
k
->
val
,
to
);
...
...
@@ -641,7 +634,7 @@ struct mapping *copy_mapping(struct mapping *m)
n
=
allocate_mapping
(
MAP_SLOTS
(
m
->
size
));
LOOP
(
m
)
mapping_insert
(
n
,
&
k
->
ind
,
&
k
->
val
);
MAPPING_
LOOP
(
m
)
mapping_insert
(
n
,
&
k
->
ind
,
&
k
->
val
);
return
n
;
}
...
...
@@ -702,7 +695,7 @@ struct mapping *add_mappings(struct svalue *argp, INT32 args)
for
(
e
=
d
=
0
;
d
<
args
;
d
++
)
e
+=
argp
[
d
].
u
.
mapping
->
size
;
ret
=
allocate_mapping
(
MAP_SLOTS
(
e
));
for
(
d
=
0
;
d
<
args
;
d
++
)
LOOP
(
argp
[
d
].
u
.
mapping
)
MAPPING_
LOOP
(
argp
[
d
].
u
.
mapping
)
mapping_insert
(
ret
,
&
k
->
ind
,
&
k
->
val
);
return
ret
;
}
...
...
@@ -727,7 +720,7 @@ int mapping_equal_p(struct mapping *a, struct mapping *b, struct processing *p)
check_mapping_for_destruct
(
a
);
check_mapping_for_destruct
(
b
);
LOOP
(
a
)
MAPPING_
LOOP
(
a
)
{
struct
svalue
*
s
;
if
((
s
=
low_mapping_lookup
(
b
,
&
k
->
ind
)))
...
...
@@ -770,7 +763,7 @@ void describe_mapping(struct mapping *m,struct processing *p,int indent)
q
=
0
;
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
{
if
(
q
)
{
...
...
@@ -874,7 +867,7 @@ struct mapping *copy_mapping_recursively(struct mapping *m,
check_stack
(
2
);
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
{
copy_svalues_recursively_no_free
(
sp
,
&
k
->
ind
,
1
,
p
);
sp
++
;
...
...
@@ -993,7 +986,7 @@ void gc_mark_mapping_as_referenced(struct mapping *m)
{
if
((
m
->
ind_types
|
m
->
val_types
)
&
BIT_COMPLEX
)
{
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
{
/* We do not want to count this key:index pair if
* the index is a destructed object or function
...
...
@@ -1019,7 +1012,7 @@ void gc_check_all_mappings(void)
{
if
((
m
->
ind_types
|
m
->
val_types
)
&
BIT_COMPLEX
)
{
LOOP
(
m
)
MAPPING_
LOOP
(
m
)
{
/* We do not want to count this key:index pair if
* the index is a destructed object or function
...
...
This diff is collapsed.
Click to expand it.
src/mapping.h
+
8
−
2
View file @
0cde283c
...
...
@@ -5,13 +5,19 @@
\*/
/*
* $Id: mapping.h,v 1.1
1
1998/0
4/24 00:01:3
2 hubbe Exp $
* $Id: mapping.h,v 1.1
2
1998/0
5/14 21:45:2
2 hubbe Exp $
*/
#ifndef MAPPING_H
#define MAPPING_H
#include
"las.h"
struct
keypair
{
struct
keypair
*
next
;
struct
svalue
ind
,
val
;
};
struct
mapping
{
INT32
refs
,
size
,
hashsize
;
...
...
@@ -26,11 +32,11 @@ extern struct mapping *first_mapping;
#define m_sizeof(m) ((m)->size)
#define m_ind_types(m) ((m)->ind_types)
#define m_val_types(m) ((m)->val_types)
#define MAPPING_LOOP(m) for(e=0;e<m->hashsize;e++) for(k=m->hash[e];k;k=k->next)
#define free_mapping(M) do{ struct mapping *m_=(M); debug_malloc_touch(m_); if(!--m_->refs) really_free_mapping(m_); }while(0)
/* Prototypes begin here */
struct
keypair
;
struct
mapping
*
allocate_mapping
(
int
size
);
void
really_free_mapping
(
struct
mapping
*
m
);
void
mapping_fix_type_field
(
struct
mapping
*
m
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment