Commit Graph

42 Commits

Author SHA1 Message Date
Russell Bryant 604b819b1c Add a locking section to the coding guidelines document.
This section covers some locking fundamentals, as well as some information on
locking as it is used in Asterisk.  It describes some of the ways that are used
and could be used to achieve deadlock avoidance.  It also demonstrates the
unfortunate conclusion that with the use of recursive locks, none of the
constructs in use today are failsafe from deadlocks.  Finally, it makes some
recommendations for new code being written.  As proper locking strategies is a
complex subject, this section still has room for expansion and improvement.

This is a result of collaboration between Luigi Rizzo and myself on the 
asterisk-dev mailing list.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-02 12:08:33 +00:00
Russell Bryant dc5c54eaf2 a few minor updates and typo fixes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@126515 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-30 12:49:56 +00:00
Michiel van Baak 8e8359465b Older versions of GNU gcc do not allow 'NULL' as sentinel.
They want (char *)NULL as sentinel.
An example is OpenBSD (confirmed on 4.3) that ships with gcc 3.3.4

This commit introduces a contstant SENTINEL which is declared as:
#define SENTINEL ((char *)NULL)

All places I could test compile on my openbsd system are converted.
Update CODING-GUIDELINES to tell about this constant.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@124127 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-19 20:48:33 +00:00
Tilghman Lesher 631d8e5fbe fileio.h does not exist; io.h does, though.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-17 15:12:52 +00:00
Tilghman Lesher a616346c6d 1) Make braces mandatory for if/for/while, even around single statements.
2) Revise the argument parsing section, showing use of the standard macros.
3) Fix a typo.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104176 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-26 18:40:26 +00:00
Olle Johansson d66be1efca A minor update, caused by a recent bug report ;-)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-18 07:56:29 +00:00
Luigi Rizzo 97a87204fc small documentation update (nothing important).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-18 07:22:26 +00:00
Luigi Rizzo b70e98be1a add a bit of info on the build infrastructure
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@92084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-10 04:38:49 +00:00
Luigi Rizzo 45491422b8 new info on the management of headers
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-22 07:10:37 +00:00
Mark Michelson e14ac6f380 Merged revisions 82376 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82376 | mmichelson | 2007-09-14 09:42:29 -0500 (Fri, 14 Sep 2007) | 5 lines

Fixing a typo in the coding guidelines

(closes issue #10717, reported and patched by leedm777)


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82377 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-14 14:44:15 +00:00
Russell Bryant bcd0bf437a add a note about inline comments
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-05 14:59:34 +00:00
Russell Bryant a45cf4d0fb add a note about using the intenal API for creating detached threads
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-24 19:11:09 +00:00
Steve Murphy 02337303ef a small upgrade to the coding standard, and an update to the code that triggered the upgrade.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@63048 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-04 17:49:20 +00:00
Tilghman Lesher cfaf938f21 More spelling fixes (issue 7930)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@42735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-11 17:02:37 +00:00
Russell Bryant 723448c1f1 fix minor typo in coding guidelines
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@42684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-11 04:17:23 +00:00
Russell Bryant 8f08d7cc13 update to mention svn instead of cvs
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-07-23 02:50:25 +00:00
Russell Bryant d146e7b92c fix typo in the provided indent command
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@18694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-10 01:54:13 +00:00
Olle Johansson a0b9439bee Clarify syntax of new manager events that reports a status.
We do not longer approve "ThisEventOn" and "ThisEventOff" named events,
they need to be named "ThisEvent" with a status header showing the
current status.
(Approved by Mark)
Old events won't be changed to keep backwards compatibility,
until we have a revision plan for the AMI.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17199 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-04 07:59:02 +00:00
Kevin P. Fleming 96bf384e7d major dialplan functions update
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL()


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9674 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-12 04:28:58 +00:00
Russell Bryant 55c8fc92a9 Various cleanups from comments in an email from Luigi Rizzo. Thank you!
- Use a cleaner syntax for declaring the allocation macros
- Fix return value for ast_strdup/ast_strndup
- remove safe_strdup from app_macro, since ast_strup does the same thing
- fix a place in app_queue where ast_calloc+strncpy was used instead of
  ast_strdup.  If you are helping out with these conversions, please watch out
  for other places where this is done.
- add a note to the coding guidelines about the fix to app_queue


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-13 18:38:55 +00:00
Russell Bryant 79aa72e2e7 fix typo, thanks Qwell!
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-11 00:06:15 +00:00
Russell Bryant 15fb0b2061 Add wrappers for commonly used memory allocation functions. These wrappers
add an automatically generated Asterisk log message if the allocation fails
for some reason.  Otherwise, they are functionally the same, with the
exception of ast_strdup and ast_strndup.  These functions have the added
ability to accept a NULL argument without error, which will just be ignored
without generating an error. The coding guidelines have also been updated to 
reflect all of this information.  (issue #4996)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7952 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-10 23:51:42 +00:00
Kevin P. Fleming 2c65582b66 remove extraneous svn:executable properties
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-29 18:24:39 +00:00
Russell Bryant 14d426098e issue #5709
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-10 23:08:00 +00:00
Kevin P. Fleming b099701da9 various text/formatting updates (issue #5503 plus some minor additions)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6909 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-31 22:47:58 +00:00
Russell Bryant 11fae70fca update guidelines to explain indent parameteres (bug #4742)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6163 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-19 17:59:27 +00:00
Kevin P. Fleming 5bf8872b42 more thoughts
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6078 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-10 23:58:07 +00:00
Kevin P. Fleming 312122c113 minor fixes, and more topics covered
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-10 23:51:10 +00:00
Kevin P. Fleming b6ae77bcdf update guidelines to follow their own rules for whitespace (bug #4486)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5880 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-06-07 21:28:56 +00:00
Kevin P. Fleming 6cb7849dcb add guidelines for doxygen documentation writing (bug #4417, with mods)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-06-02 19:38:55 +00:00
Kevin P. Fleming 5c33b52ced add a minor allocation/zeroing guideline
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5817 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-06-02 19:17:04 +00:00
Kevin P. Fleming c8889e6563 add IAXPEER function (bug #4310, with minor formatting and doc changes)
add note to CODING-GUIDELINES about minimizing indentation in function bodies


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-19 04:31:02 +00:00
Kevin P. Fleming 9bf21dbf58 more strncpy -> ast_copy_string conversions, fixing some buglets along the way
add recommendation to CODING-GUIDELINES to use ast_copy_string instead of strncpy in new code


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5686 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-15 23:26:45 +00:00
Kevin P. Fleming 6cd346ebe1 add some notes regarding the distinction between applications and functions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-01 19:34:50 +00:00
Kevin P. Fleming f9876ccfa8 add guideline comment about not using '%i' with scanf
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-04-23 15:11:28 +00:00
Kevin P. Fleming 93c8e08989 Update README to reflect modern Asterisk features and requirements
Add note in UPGRADE.txt about compiler requirements
Add note to CODING-GUIDELINES about new policy for CLI command structure


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-04-01 04:38:12 +00:00
Anthony Minessale II 01a2a2a19f Modify code example suggestion
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4844 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-01-19 02:34:59 +00:00
Mark Spencer 581ae73586 Additional coding guidelines (bug #3374)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-01-18 23:35:30 +00:00
Mark Spencer dd7e72feca Provide "ident" command line (at least the start of one)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-11-08 02:49:33 +00:00
Mark Spencer 99876da380 Update coding guidelines
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3000 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-05-18 05:52:52 +00:00
Mark Spencer 2293ad0b1f Update coding guidelines, fix "say.c" compile on older compilers, update coding guidelines (includes bug #1631)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-05-15 15:34:31 +00:00
James Golovich 09eeb42315 Add doc/CODING-GUIDELINES document
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2863 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-05-02 19:24:05 +00:00