[Home]

Summary:ASTERISK-11520: [patch] meaningful variable names in chan_zap
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2008-02-26 18:37:23.000-0600Date Closed:2008-03-04 12:51:40.000-0600
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Channels/chan_zap
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) alloc_sub
( 1) mkintf-rename_p
( 2) mkintf-rename_tmp
( 3) zt_new-rename_i
( 4) zt_new-rename_tmp
Description:chan_zap has a number of lengthy functions with variables that carry descriptive names of the sort of 'tmp', 'i' and 'p'. Patches here try to at least give more meaningful names to those variables.

While I was at it, I added a small patch to reduce nesting in alloc_sub() which is really not worth a separate bug report.

****** ADDITIONAL INFORMATION ******

Some of the attached patches depend on one another (as they are applied to the same functions). Their order is currently:

alloc_sub
zt_new-rename_tmp
zt_new-rename_i
mkintf-rename_p
mkintf-rename_tmp

And before I forget, a useful vim command for replacing: go to the beginning of the function, and use (in this case to rename 'tmp' to 'chan_zap') -

:.,/^}/s/\<tmp\>/zap_chan/gc
Comments:By: Digium Subversion (svnbot) 2008-02-27 17:55:19.000-0600

Repository: asterisk
Revision: 104866

U   trunk/channels/chan_zap.c

------------------------------------------------------------------------
r104866 | russell | 2008-02-27 17:55:16 -0600 (Wed, 27 Feb 2008) | 6 lines

reduce indentation in alloc_sub
(issue ASTERISK-11520)
Reported by: tzafrir
Patches:
     alloc_sub uploaded by tzafrir (license 46)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=104866

By: Russell Bryant (russell) 2008-02-27 17:56:35.000-0600

I applied the first patch, but personally, I am not ok with applying all of the patches to simply rename variables.  It's going to break various patches and make porting between 1.4 more difficult without enough benefit, IMO.

By: Digium Subversion (svnbot) 2008-03-03 12:45:51.000-0600

Repository: asterisk
Revision: 105574

U   trunk/channels/chan_zap.c

------------------------------------------------------------------------
r105574 | russell | 2008-03-03 12:45:46 -0600 (Mon, 03 Mar 2008) | 4 lines

Fix some code that was improperly changed in revision 104866 from issue ASTERISK-11520.

(closes issue ASTERISK-11566, reported by elguero, patched by me)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=105574

By: Digium Subversion (svnbot) 2008-03-04 11:13:38.000-0600

Repository: asterisk
Revision: 105602

_U  team/group/multiparking/
U   team/group/multiparking/CHANGES
U   team/group/multiparking/channels/chan_local.c
U   team/group/multiparking/channels/chan_sip.c
U   team/group/multiparking/channels/chan_zap.c
U   team/group/multiparking/funcs/func_version.c
U   team/group/multiparking/include/asterisk/_private.h
U   team/group/multiparking/main/asterisk.c
U   team/group/multiparking/main/autoservice.c
U   team/group/multiparking/main/channel.c
U   team/group/multiparking/main/hashtab.c
U   team/group/multiparking/main/pbx.c
U   team/group/multiparking/res/snmp/agent.c

------------------------------------------------------------------------
r105602 | mvanbaak | 2008-03-04 11:13:33 -0600 (Tue, 04 Mar 2008) | 196 lines

Merged revisions 105558,105561,105564,105566,105569,105571,105573-105574,105589-105590,105592-105595,105597 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r105558 | file | 2008-03-03 16:16:57 +0100 (Mon, 03 Mar 2008) | 14 lines

Merged revisions 105557 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105557 | file | 2008-03-03 11:15:39 -0400 (Mon, 03 Mar 2008) | 6 lines

Add a comment to describe some logic.
(closes issue ASTERISK-11558)
Reported by: flefoll
Patches:
     chan_sip.c.br14.patch-just-a-comment uploaded by flefoll (license 244)

........

................
r105561 | file | 2008-03-03 16:30:29 +0100 (Mon, 03 Mar 2008) | 15 lines

Merged revisions 105560 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105560 | file | 2008-03-03 11:28:59 -0400 (Mon, 03 Mar 2008) | 7 lines

It is possible for no audio to pass between the current digit and next digit so expand logic that clears emulation to AST_FRAME_NULL.
(closes issue ASTERISK-11364)
Reported by: edgreenberg
Patches:
     v1-11911.patch uploaded by dimas (license 88)
Tested by: tbsky

........

................
r105564 | russell | 2008-03-03 16:59:50 +0100 (Mon, 03 Mar 2008) | 40 lines

3) In addition to merging the changes below, change trunk back to a regular
  LIST instead of an RWLIST.  The way this list works makes it such that
  a RWLIST provides no additional benefit.  Also, a mutex is needed for
  use with the thread condition.


Merged revisions 105563 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105563 | russell | 2008-03-03 09:50:43 -0600 (Mon, 03 Mar 2008) | 24 lines

Merge in some changes from team/russell/autoservice-nochans-1.4

These changes fix up some dubious code that I came across while auditing what
happens in the autoservice thread when there are no channels currently in
autoservice.

1) Change it so that autoservice thread doesn't keep looping around calling
  ast_waitfor_n() on 0 channels twice a second.  Instead, use a thread condition
  so that the thread properly goes to sleep and does not wake up until a
  channel is put into autoservice.

  This actually fixes an interesting bug, as well.  If the autoservice thread
  is already running (almost always is the case), then when the thread goes
  from having 0 channels to have 1 channel to autoservice, that channel would
  have to wait for up to 1/2 of a second to have the first frame read from it.

2) Fix up the code in ast_waitfor_nandfds() for when it gets called with no
  channels and no fds to poll() on, such as was the case with the previous code
  for the autoservice thread.  In this case, the code would call alloca(0), and
  pass the result as the first argument to poll().  In this case, the 2nd
  argument to poll() specified that there were no fds, so this invalid pointer
  shouldn't actually get dereferenced, but, this code makes it explicit and
  ensures the pointers are NULL unless we have valid data to put there.

(related to issue ASTERISK-11555)

........

................
r105566 | russell | 2008-03-03 17:02:19 +0100 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105565 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105565 | russell | 2008-03-03 10:01:50 -0600 (Mon, 03 Mar 2008) | 3 lines

Update the copyright information for autoservice.  Most of the code in this file
now is stuff that I have written recently ...

........

................
r105569 | russell | 2008-03-03 18:06:35 +0100 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105568 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105568 | russell | 2008-03-03 11:05:16 -0600 (Mon, 03 Mar 2008) | 3 lines

Fix a potential memory leak of the local_pvt struct when ast_channel allocation
fails.  Also, in passing, centralize the code necessary to destroy a local_pvt.

........

................
r105571 | russell | 2008-03-03 18:17:27 +0100 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105570 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105570 | russell | 2008-03-03 11:16:53 -0600 (Mon, 03 Mar 2008) | 3 lines

In the case of an ast_channel allocation failure, take the local_pvt out of the
pvt list before destroying it.

........

................
r105573 | qwell | 2008-03-03 19:08:05 +0100 (Mon, 03 Mar 2008) | 15 lines

Merged revisions 105572 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105572 | qwell | 2008-03-03 12:06:52 -0600 (Mon, 03 Mar 2008) | 7 lines

Fix types for astNumChannels and astConfigCallsProcessed.

(closes issue ASTERISK-11553)
Reported by: jeffg
Patches:
     12114.patch uploaded by jeffg (license 192)

........

................
r105574 | russell | 2008-03-03 19:49:34 +0100 (Mon, 03 Mar 2008) | 4 lines

Fix some code that was improperly changed in revision 104866 from issue ASTERISK-11520.

(closes issue ASTERISK-11566, reported by elguero, patched by me)

................
r105589 | russell | 2008-03-04 05:26:39 +0100 (Tue, 04 Mar 2008) | 3 lines

Use ast_copy_string() instead of strncpy(), and use sizeof() instead of
a magic number

................
r105590 | russell | 2008-03-04 05:28:48 +0100 (Tue, 04 Mar 2008) | 3 lines

- Add curly braces around the while loop
- Properly break out of the loop on error when an included context is not found

................
r105592 | russell | 2008-03-04 05:31:53 +0100 (Tue, 04 Mar 2008) | 11 lines

Blocked revisions 105591 via svnmerge

........
r105591 | russell | 2008-03-03 22:31:29 -0600 (Mon, 03 Mar 2008) | 4 lines

Backport a minor bug fix from trunk that I found while doing random code
cleanup.  Properly break out of the loop when a context isn't found when
verify that includes are valid.

........

................
r105593 | russell | 2008-03-04 05:44:28 +0100 (Tue, 04 Mar 2008) | 2 lines

remove unnecessary casts

................
r105594 | russell | 2008-03-04 05:47:32 +0100 (Tue, 04 Mar 2008) | 2 lines

Make it so you don't have to cast away const in a couple places

................
r105595 | russell | 2008-03-04 05:57:29 +0100 (Tue, 04 Mar 2008) | 2 lines

Simplify a trivial snprintf() with ast_copy_string()

................
r105597 | russell | 2008-03-04 17:55:17 +0100 (Tue, 04 Mar 2008) | 2 lines

Update CHANGES heading

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=105602

By: Digium Subversion (svnbot) 2008-03-04 12:51:40.000-0600

Repository: asterisk
Revision: 105728

_U  team/murf/bug6002/
U   team/murf/bug6002/CHANGES
U   team/murf/bug6002/channels/chan_local.c
U   team/murf/bug6002/channels/chan_sip.c
U   team/murf/bug6002/channels/chan_zap.c
U   team/murf/bug6002/funcs/func_version.c
U   team/murf/bug6002/include/asterisk/_private.h
U   team/murf/bug6002/include/asterisk/rtp.h
U   team/murf/bug6002/main/asterisk.c
U   team/murf/bug6002/main/autoservice.c
U   team/murf/bug6002/main/channel.c
U   team/murf/bug6002/main/hashtab.c
U   team/murf/bug6002/main/pbx.c
U   team/murf/bug6002/main/rtp.c
U   team/murf/bug6002/res/snmp/agent.c

------------------------------------------------------------------------
r105728 | murf | 2008-03-04 12:51:34 -0600 (Tue, 04 Mar 2008) | 228 lines

Merged revisions 105558,105561,105564,105566,105569,105571,105573-105574,105589-105590,105592-105595,105597,105675,105677 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r105558 | file | 2008-03-03 08:16:57 -0700 (Mon, 03 Mar 2008) | 14 lines

Merged revisions 105557 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105557 | file | 2008-03-03 11:15:39 -0400 (Mon, 03 Mar 2008) | 6 lines

Add a comment to describe some logic.
(closes issue ASTERISK-11558)
Reported by: flefoll
Patches:
     chan_sip.c.br14.patch-just-a-comment uploaded by flefoll (license 244)

........

................
r105561 | file | 2008-03-03 08:30:29 -0700 (Mon, 03 Mar 2008) | 15 lines

Merged revisions 105560 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105560 | file | 2008-03-03 11:28:59 -0400 (Mon, 03 Mar 2008) | 7 lines

It is possible for no audio to pass between the current digit and next digit so expand logic that clears emulation to AST_FRAME_NULL.
(closes issue ASTERISK-11364)
Reported by: edgreenberg
Patches:
     v1-11911.patch uploaded by dimas (license 88)
Tested by: tbsky

........

................
r105564 | russell | 2008-03-03 08:59:50 -0700 (Mon, 03 Mar 2008) | 40 lines

3) In addition to merging the changes below, change trunk back to a regular
  LIST instead of an RWLIST.  The way this list works makes it such that
  a RWLIST provides no additional benefit.  Also, a mutex is needed for
  use with the thread condition.


Merged revisions 105563 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105563 | russell | 2008-03-03 09:50:43 -0600 (Mon, 03 Mar 2008) | 24 lines

Merge in some changes from team/russell/autoservice-nochans-1.4

These changes fix up some dubious code that I came across while auditing what
happens in the autoservice thread when there are no channels currently in
autoservice.

1) Change it so that autoservice thread doesn't keep looping around calling
  ast_waitfor_n() on 0 channels twice a second.  Instead, use a thread condition
  so that the thread properly goes to sleep and does not wake up until a
  channel is put into autoservice.

  This actually fixes an interesting bug, as well.  If the autoservice thread
  is already running (almost always is the case), then when the thread goes
  from having 0 channels to have 1 channel to autoservice, that channel would
  have to wait for up to 1/2 of a second to have the first frame read from it.

2) Fix up the code in ast_waitfor_nandfds() for when it gets called with no
  channels and no fds to poll() on, such as was the case with the previous code
  for the autoservice thread.  In this case, the code would call alloca(0), and
  pass the result as the first argument to poll().  In this case, the 2nd
  argument to poll() specified that there were no fds, so this invalid pointer
  shouldn't actually get dereferenced, but, this code makes it explicit and
  ensures the pointers are NULL unless we have valid data to put there.

(related to issue ASTERISK-11555)

........

................
r105566 | russell | 2008-03-03 09:02:19 -0700 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105565 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105565 | russell | 2008-03-03 10:01:50 -0600 (Mon, 03 Mar 2008) | 3 lines

Update the copyright information for autoservice.  Most of the code in this file
now is stuff that I have written recently ...

........

................
r105569 | russell | 2008-03-03 10:06:35 -0700 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105568 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105568 | russell | 2008-03-03 11:05:16 -0600 (Mon, 03 Mar 2008) | 3 lines

Fix a potential memory leak of the local_pvt struct when ast_channel allocation
fails.  Also, in passing, centralize the code necessary to destroy a local_pvt.

........

................
r105571 | russell | 2008-03-03 10:17:27 -0700 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105570 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105570 | russell | 2008-03-03 11:16:53 -0600 (Mon, 03 Mar 2008) | 3 lines

In the case of an ast_channel allocation failure, take the local_pvt out of the
pvt list before destroying it.

........

................
r105573 | qwell | 2008-03-03 11:08:05 -0700 (Mon, 03 Mar 2008) | 15 lines

Merged revisions 105572 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105572 | qwell | 2008-03-03 12:06:52 -0600 (Mon, 03 Mar 2008) | 7 lines

Fix types for astNumChannels and astConfigCallsProcessed.

(closes issue ASTERISK-11553)
Reported by: jeffg
Patches:
     12114.patch uploaded by jeffg (license 192)

........

................
r105574 | russell | 2008-03-03 11:49:34 -0700 (Mon, 03 Mar 2008) | 4 lines

Fix some code that was improperly changed in revision 104866 from issue ASTERISK-11520.

(closes issue ASTERISK-11566, reported by elguero, patched by me)

................
r105589 | russell | 2008-03-03 21:26:39 -0700 (Mon, 03 Mar 2008) | 3 lines

Use ast_copy_string() instead of strncpy(), and use sizeof() instead of
a magic number

................
r105590 | russell | 2008-03-03 21:28:48 -0700 (Mon, 03 Mar 2008) | 3 lines

- Add curly braces around the while loop
- Properly break out of the loop on error when an included context is not found

................
r105592 | russell | 2008-03-03 21:31:53 -0700 (Mon, 03 Mar 2008) | 11 lines

Blocked revisions 105591 via svnmerge

........
r105591 | russell | 2008-03-03 22:31:29 -0600 (Mon, 03 Mar 2008) | 4 lines

Backport a minor bug fix from trunk that I found while doing random code
cleanup.  Properly break out of the loop when a context isn't found when
verify that includes are valid.

........

................
r105593 | russell | 2008-03-03 21:44:28 -0700 (Mon, 03 Mar 2008) | 2 lines

remove unnecessary casts

................
r105594 | russell | 2008-03-03 21:47:32 -0700 (Mon, 03 Mar 2008) | 2 lines

Make it so you don't have to cast away const in a couple places

................
r105595 | russell | 2008-03-03 21:57:29 -0700 (Mon, 03 Mar 2008) | 2 lines

Simplify a trivial snprintf() with ast_copy_string()

................
r105597 | russell | 2008-03-04 09:55:17 -0700 (Tue, 04 Mar 2008) | 2 lines

Update CHANGES heading

................
r105675 | file | 2008-03-04 11:08:42 -0700 (Tue, 04 Mar 2008) | 16 lines

Merged revisions 105674 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105674 | file | 2008-03-04 14:05:28 -0400 (Tue, 04 Mar 2008) | 8 lines

When a new source of audio comes in (such as music on hold) make sure the marker bit gets set.
(closes issue ASTERISK-10000)
Reported by: wdecarne
Patches:
     10355.diff uploaded by file (license 11)
(closes issue ASTERISK-10992)
Reported by: kanderson

........

................
r105677 | file | 2008-03-04 11:11:38 -0700 (Tue, 04 Mar 2008) | 10 lines

Merged revisions 105676 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105676 | file | 2008-03-04 14:10:34 -0400 (Tue, 04 Mar 2008) | 2 lines

In addition to setting the marker bit let's change our ssrc so they know for sure it is a different source.

........

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=105728