[Home]

Summary:ASTERISK-12730: [patch] remove zap/dahdi-related code duplications with some #define-s
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2008-09-14 18:32:50Date Closed:2008-12-19 13:49:21.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) dahdi_define_remove_dup.diff
Description:The following patch adds 2 different #define-d constants that are set differently for Zaptel and for DAHDI (through DAHDI_COMPAT), and then 3 more common defined names,

It uses those to reduce code duplication regarding /dev/zap vs. /dev/dahdi .

e.g.:

#ifdef HAVE_ZAPTEL
 fd = open("/dev/zap/pseudo", O_RDWR);
#else
 fd = open("/dev/dahdi/pseudo", O_RDWR);
#endif

is replaced with:
 fd = open(DAHDI_FILE_PSEUDO, O_RDRW);
Comments:By: Tzafrir Cohen (tzafrir) 2008-10-20 07:55:27

Fixed some typos in the patch

By: Jeff Peeler (jpeeler) 2008-12-18 14:42:05.000-0600

Did you consider using dahdi_chan_name rather than the DAHDI_NAME define? I bring this up simply for no reason other than limiting the number of places the string is set.

By: Digium Subversion (svnbot) 2008-12-19 13:48:13.000-0600

Repository: asterisk
Revision: 165991

U   branches/1.4/apps/app_dahdibarge.c
U   branches/1.4/apps/app_dahdiscan.c
U   branches/1.4/apps/app_meetme.c
U   branches/1.4/channels/chan_dahdi.c
U   branches/1.4/channels/chan_iax2.c
U   branches/1.4/codecs/codec_dahdi.c
U   branches/1.4/include/asterisk/dahdi_compat.h
U   branches/1.4/main/asterisk.c
U   branches/1.4/main/channel.c
U   branches/1.4/res/res_musiconhold.c

------------------------------------------------------------------------
r165991 | jpeeler | 2008-12-19 13:48:12 -0600 (Fri, 19 Dec 2008) | 15 lines

(closes issue ASTERISK-12730)
Reported by: tzafrir

Replace a bunch of if defined checks for Zaptel/DAHDI through several new defines in dahdi_compat.h. This removes a lot of code duplication. Example from bug:

#ifdef HAVE_ZAPTEL
 fd = open("/dev/zap/pseudo", O_RDWR);
#else
 fd = open("/dev/dahdi/pseudo", O_RDWR);
#endif

is replaced with:
 fd = open(DAHDI_FILE_PSEUDO, O_RDRW);


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

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

By: Digium Subversion (svnbot) 2008-12-19 13:49:20.000-0600

Repository: asterisk
Revision: 165992

_U  trunk/

------------------------------------------------------------------------
r165992 | jpeeler | 2008-12-19 13:49:20 -0600 (Fri, 19 Dec 2008) | 22 lines

Blocked revisions 165991 via svnmerge

........
r165991 | jpeeler | 2008-12-19 13:48:00 -0600 (Fri, 19 Dec 2008) | 15 lines

(closes issue ASTERISK-12730)
Reported by: tzafrir

Replace a bunch of if defined checks for Zaptel/DAHDI through several new defines in dahdi_compat.h. This removes a lot of code duplication. Example from bug:

#ifdef HAVE_ZAPTEL
 fd = open("/dev/zap/pseudo", O_RDWR);
#else
 fd = open("/dev/dahdi/pseudo", O_RDWR);
#endif

is replaced with:
 fd = open(DAHDI_FILE_PSEUDO, O_RDRW);


........

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

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