Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
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
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
9ef0eb64
Commit
9ef0eb64
authored
8 years ago
by
zuul
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "logger: Simplify ast_callid handling code."
parents
57b29f3b
923edf25
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main/logger.c
+11
-40
11 additions, 40 deletions
main/logger.c
with
11 additions
and
40 deletions
main/logger.c
+
11
−
40
View file @
9ef0eb64
...
...
@@ -1764,13 +1764,7 @@ void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid)
ast_callid
ast_create_callid
(
void
)
{
ast_callid
call
;
call
=
ast_atomic_fetchadd_int
(
&
next_unique_callid
,
+
1
);
#ifdef TEST_FRAMEWORK
ast_debug
(
3
,
"CALL_ID [C-%08x] created by thread.
\n
"
,
call
);
#endif
return
call
;
return
ast_atomic_fetchadd_int
(
&
next_unique_callid
,
+
1
);
}
ast_callid
ast_read_threadstorage_callid
(
void
)
...
...
@@ -1780,7 +1774,6 @@ ast_callid ast_read_threadstorage_callid(void)
callid
=
ast_threadstorage_get
(
&
unique_callid
,
sizeof
(
*
callid
));
return
callid
?
*
callid
:
0
;
}
int
ast_callid_threadassoc_change
(
ast_callid
callid
)
...
...
@@ -1788,23 +1781,10 @@ int ast_callid_threadassoc_change(ast_callid callid)
ast_callid
*
id
=
ast_threadstorage_get
(
&
unique_callid
,
sizeof
(
*
id
));
if
(
!
id
)
{
ast_log
(
LOG_ERROR
,
"Failed to allocate thread storage.
\n
"
);
return
-
1
;
}
if
(
*
id
&&
(
*
id
!=
callid
))
{
#ifdef TEST_FRAMEWORK
ast_debug
(
3
,
"CALL_ID [C-%08x] being removed from thread.
\n
"
,
*
id
);
#endif
*
id
=
0
;
}
if
(
!
(
*
id
)
&&
callid
)
{
*
id
=
callid
;
#ifdef TEST_FRAMEWORK
ast_debug
(
3
,
"CALL_ID [C-%08x] bound to thread.
\n
"
,
callid
);
#endif
}
*
id
=
callid
;
return
0
;
}
...
...
@@ -1814,21 +1794,17 @@ int ast_callid_threadassoc_add(ast_callid callid)
ast_callid
*
pointing
;
pointing
=
ast_threadstorage_get
(
&
unique_callid
,
sizeof
(
*
pointing
));
if
(
!
(
pointing
))
{
ast_log
(
LOG_ERROR
,
"Failed to allocate thread storage.
\n
"
);
if
(
!
pointing
)
{
return
-
1
;
}
if
(
!
(
*
pointing
))
{
*
pointing
=
callid
;
#ifdef TEST_FRAMEWORK
ast_debug
(
3
,
"CALL_ID [C-%08x] bound to thread.
\n
"
,
callid
);
#endif
}
else
{
ast_log
(
LOG_WARNING
,
"Attempted to ast_callid_threadassoc_add on thread already associated with a callid.
\n
"
);
if
(
*
pointing
)
{
ast_log
(
LOG_ERROR
,
"ast_callid_threadassoc_add(C-%08x) on thread "
"already associated with callid [C-%08x].
\n
"
,
callid
,
*
pointing
);
return
1
;
}
*
pointing
=
callid
;
return
0
;
}
...
...
@@ -1837,21 +1813,16 @@ int ast_callid_threadassoc_remove(void)
ast_callid
*
pointing
;
pointing
=
ast_threadstorage_get
(
&
unique_callid
,
sizeof
(
*
pointing
));
if
(
!
(
pointing
))
{
ast_log
(
LOG_ERROR
,
"Failed to allocate thread storage.
\n
"
);
if
(
!
pointing
)
{
return
-
1
;
}
if
(
!
(
*
pointing
))
{
ast_log
(
LOG_ERROR
,
"Tried to clean callid thread storage with no callid in thread storage.
\n
"
);
return
-
1
;
}
else
{
#ifdef TEST_FRAMEWORK
ast_debug
(
3
,
"CALL_ID [C-%08x] being removed from thread.
\n
"
,
*
pointing
);
#endif
if
(
*
pointing
)
{
*
pointing
=
0
;
return
0
;
}
return
-
1
;
}
int
ast_callid_threadstorage_auto
(
ast_callid
*
callid
)
...
...
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