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
3b6bff14
Commit
3b6bff14
authored
22 years ago
by
Martin Stjernholm
Browse files
Options
Downloads
Patches
Plain Diff
Added a macro to get some debug trace.
Rev: src/cyclic.c:1.9 Rev: src/cyclic.h:1.8
parent
c64c0950
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cyclic.c
+12
-3
12 additions, 3 deletions
src/cyclic.c
src/cyclic.h
+20
-5
20 additions, 5 deletions
src/cyclic.h
with
32 additions
and
8 deletions
src/cyclic.c
+
12
−
3
View file @
3b6bff14
...
...
@@ -2,13 +2,13 @@
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
|| $Id: cyclic.c,v 1.
8
2002/1
0/11 01:39:30 nilsson
Exp $
|| $Id: cyclic.c,v 1.
9
2002/1
2/01 17:36:03 mast
Exp $
*/
#include
"global.h"
#include
"cyclic.h"
RCSID
(
"$Id: cyclic.c,v 1.
8
2002/1
0/11 01:39:30 nilsson
Exp $"
);
RCSID
(
"$Id: cyclic.c,v 1.
9
2002/1
2/01 17:36:03 mast
Exp $"
);
#define CYCLIC_HASH_SIZE 4711
...
...
@@ -33,6 +33,9 @@ static void low_unlink_cyclic(CYCLIC *c)
if
(
c
==
*
p
)
{
*
p
=
c
->
next
;
#ifdef CYCLIC_DEBUG
fprintf
(
stderr
,
"%s: END_CYCLIC a=%p b=%p: no cycle
\n
"
,
c
->
id
,
c
->
a
,
c
->
b
);
#endif
return
;
}
}
...
...
@@ -46,7 +49,7 @@ void unlink_cyclic(CYCLIC *c)
}
void
*
begin_cyclic
(
CYCLIC
*
c
,
void
*
id
,
char
*
id
,
void
*
th
,
void
*
a
,
void
*
b
)
...
...
@@ -69,6 +72,9 @@ void *begin_cyclic(CYCLIC *c,
{
if
(
a
==
p
->
a
&&
b
==
p
->
b
&&
id
==
p
->
id
)
{
#ifdef CYCLIC_DEBUG
fprintf
(
stderr
,
"%s: BEGIN_CYCLIC a=%p b=%p: found cycle
\n
"
,
id
,
a
,
b
);
#endif
ret
=
p
->
ret
;
break
;
}
...
...
@@ -82,5 +88,8 @@ void *begin_cyclic(CYCLIC *c,
c
->
next
=
cyclic_hash
[
h
];
cyclic_hash
[
h
]
=
c
;
SET_ONERROR
(
c
->
onerr
,
low_unlink_cyclic
,
c
);
#ifdef CYCLIC_DEBUG
if
(
!
ret
)
fprintf
(
stderr
,
"%s: BEGIN_CYCLIC a=%p b=%p: no cycle
\n
"
,
id
,
a
,
b
);
#endif
return
ret
;
}
This diff is collapsed.
Click to expand it.
src/cyclic.h
+
20
−
5
View file @
3b6bff14
...
...
@@ -2,7 +2,7 @@
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
|| $Id: cyclic.h,v 1.
7
2002/1
0/11 01:39:30 nilsson
Exp $
|| $Id: cyclic.h,v 1.
8
2002/1
2/01 17:36:03 mast
Exp $
*/
#ifndef CYCLIC_H
...
...
@@ -11,24 +11,39 @@
#include
"pike_error.h"
#include
"threads.h"
/* #define CYCLIC_DEBUG */
typedef
struct
CYCLIC
{
ONERROR
onerr
;
void
*
th
;
void
*
id
,
*
a
,
*
b
;
char
*
id
;
void
*
a
,
*
b
;
void
*
ret
;
struct
CYCLIC
*
next
;
}
CYCLIC
;
#ifdef CYCLIC_DEBUG
#define DECLARE_CYCLIC() \
static char cyclic_identifier__; \
static char cyclic_identifier__
[] = __FILE__ ":" DEFINETOSTR(__LINE__)
; \
CYCLIC cyclic_struct__
#define BEGIN_CYCLIC(A,B) \
begin_cyclic(&cyclic_struct__, cyclic_identifier__, \
(void *)(ptrdiff_t)th_self(), (void *)(A), (void *)(B))
#else
/* CYCLIC_DEBUG */
#define DECLARE_CYCLIC() \
static char cyclic_identifier__; \
CYCLIC cyclic_struct__
#define BEGIN_CYCLIC(A,B) \
begin_cyclic(&cyclic_struct__, &cyclic_identifier__, \
(void *)(ptrdiff_t)th_self(), (void *)(A), (void *)(B))
#endif
/* !CYCLIC_DEBUG */
#define SET_CYCLIC_RET(RET) \
cyclic_struct__.ret=(void *)(RET)
...
...
@@ -37,7 +52,7 @@ typedef struct CYCLIC
/* Prototypes begin here */
void
unlink_cyclic
(
CYCLIC
*
c
);
void
*
begin_cyclic
(
CYCLIC
*
c
,
void
*
id
,
char
*
id
,
void
*
thread
,
void
*
a
,
void
*
b
);
...
...
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