[asterisk-bugs] [Asterisk 0013480]: [patch] remove zap/dahdi-related code duplications with some #define-s

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Dec 19 13:48:13 CST 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13480 
====================================================================== 
Reported By:                tzafrir
Assigned To:                jpeeler
====================================================================== 
Project:                    Asterisk
Issue ID:                   13480
Category:                   General
Reproducibility:            N/A
Severity:                   tweak
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!): 142358 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-09-14 18:32 CDT
Last Modified:              2008-12-19 13:48 CST
====================================================================== 
Summary:                    [patch] remove zap/dahdi-related code duplications
with some #define-s
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);

====================================================================== 

---------------------------------------------------------------------- 
 (0096725) svnbot (reporter) - 2008-12-19 13:48
 http://bugs.digium.com/view.php?id=13480#c96725 
---------------------------------------------------------------------- 
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 http://bugs.digium.com/view.php?id=13480)
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 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-12-19 13:48 svnbot         Checkin                                      
2008-12-19 13:48 svnbot         Note Added: 0096725                          
======================================================================




More information about the asterisk-bugs mailing list