mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
Mostly just whitespace, but also convert 'CVS' to 'SVN' in a couple
places and fix a few typos I found in the CODING_GUIDELINES. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@167061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -76,7 +76,7 @@ envrionment can pick up the new variables.
|
|||||||
|
|
||||||
Upgrading Asterisk
|
Upgrading Asterisk
|
||||||
-----------------
|
-----------------
|
||||||
After you cvs update (or make update) Asterisk you have to go into
|
After you svn update (or make update) Asterisk you have to go into
|
||||||
asterisk/channels/h323 and issue a make clean all, before compiling the
|
asterisk/channels/h323 and issue a make clean all, before compiling the
|
||||||
rest of asterisk. Doing this process every time you upgrade Asterisk
|
rest of asterisk. Doing this process every time you upgrade Asterisk
|
||||||
will ensure a sane build.
|
will ensure a sane build.
|
||||||
|
@@ -167,7 +167,7 @@ this means in verbose:
|
|||||||
-sai: space after if
|
-sai: space after if
|
||||||
-saw: space after while
|
-saw: space after while
|
||||||
-cs: space after cast
|
-cs: space after cast
|
||||||
-ln90: line length 90 columns
|
-l90: line length 90 columns
|
||||||
|
|
||||||
Function calls and arguments should be spaced in a consistent way across
|
Function calls and arguments should be spaced in a consistent way across
|
||||||
the codebase.
|
the codebase.
|
||||||
@@ -321,7 +321,7 @@ Make some indication in the name of global variables which represent
|
|||||||
options that they are in fact intended to be global.
|
options that they are in fact intended to be global.
|
||||||
e.g.: static char global_something[80]
|
e.g.: static char global_something[80]
|
||||||
|
|
||||||
- Don't use un-necessary typedef's
|
- Don't use unnecessary typedef's
|
||||||
Don't use 'typedef' just to shorten the amount of typing; there is no substantial
|
Don't use 'typedef' just to shorten the amount of typing; there is no substantial
|
||||||
benefit in this:
|
benefit in this:
|
||||||
struct foo { int bar; }; typedef struct foo foo_t;
|
struct foo { int bar; }; typedef struct foo foo_t;
|
||||||
@@ -368,7 +368,7 @@ that has been allocated in the function doing the copying. In that case, you
|
|||||||
know at the time you are writing the code whether the buffer is large enough
|
know at the time you are writing the code whether the buffer is large enough
|
||||||
for the fixed string or not, and if it's not, your code won't work anyway!
|
for the fixed string or not, and if it's not, your code won't work anyway!
|
||||||
Use strcpy() for this operation, or directly set the first two characters
|
Use strcpy() for this operation, or directly set the first two characters
|
||||||
of the buffer if you are just trying to store a one-character string in the
|
of the buffer if you are just trying to store a one character string in the
|
||||||
buffer. If you are trying to 'empty' the buffer, just store a single
|
buffer. If you are trying to 'empty' the buffer, just store a single
|
||||||
NULL character ('\0') in the first byte of the buffer; nothing else is
|
NULL character ('\0') in the first byte of the buffer; nothing else is
|
||||||
needed, and any other method is wasteful.
|
needed, and any other method is wasteful.
|
||||||
@@ -382,14 +382,13 @@ processor operations, unlike ast_copy_string().
|
|||||||
* Use of functions
|
* Use of functions
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
For the sake of uclibc, do not use index, bcopy or bzero; use
|
For the sake of uclibc, do not use index, bcopy or bzero; use strchr(), memset(),
|
||||||
strchr(), memset(), and memmove() instead. uclibc can be configured
|
and memmove() instead. uclibc can be configured to supply these functions, but
|
||||||
to supply these functions, but we can save these users
|
we can save these users time and consternation if we abstain from using these
|
||||||
time and consternation if we abstain from using these
|
|
||||||
functions.
|
functions.
|
||||||
|
|
||||||
When making applications, always ast_strdupa(data) to a local pointer if
|
When making applications, always ast_strdupa(data) to a local pointer if you
|
||||||
you intend to parse the incoming data string.
|
intend to parse the incoming data string.
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
mydata = ast_strdupa(data);
|
mydata = ast_strdupa(data);
|
||||||
@@ -449,7 +448,7 @@ alloca(), ast_strdupa() or similar functions in the argument list
|
|||||||
of a function you are calling; this can cause very strange stack
|
of a function you are calling; this can cause very strange stack
|
||||||
arrangements and produce unexpected behavior.
|
arrangements and produce unexpected behavior.
|
||||||
|
|
||||||
-Allocations for structures
|
- Allocations for structures
|
||||||
When allocating/zeroing memory for a structure, use code like this:
|
When allocating/zeroing memory for a structure, use code like this:
|
||||||
|
|
||||||
struct foo *tmp;
|
struct foo *tmp;
|
||||||
@@ -472,7 +471,7 @@ They just add an Asterisk log error message in the case that the allocation
|
|||||||
fails for some reason. This eliminates the need to generate custom messages
|
fails for some reason. This eliminates the need to generate custom messages
|
||||||
throughout the code to log that this has occurred.
|
throughout the code to log that this has occurred.
|
||||||
|
|
||||||
-String Duplications
|
- String Duplications
|
||||||
|
|
||||||
The functions strdup and strndup can *not* accept a NULL argument. This results
|
The functions strdup and strndup can *not* accept a NULL argument. This results
|
||||||
in having code like this:
|
in having code like this:
|
||||||
@@ -595,7 +594,7 @@ Before submitting a patch, *read* the actual patch file to be sure that
|
|||||||
all the changes you expect to be there are, and that there are no
|
all the changes you expect to be there are, and that there are no
|
||||||
surprising changes you did not expect. During your development, that
|
surprising changes you did not expect. During your development, that
|
||||||
part of Asterisk may have changed, so make sure you compare with the
|
part of Asterisk may have changed, so make sure you compare with the
|
||||||
latest CVS.
|
latest SVN.
|
||||||
|
|
||||||
- Listen to advice
|
- Listen to advice
|
||||||
If you are asked to make changes to your patch, there is a good chance
|
If you are asked to make changes to your patch, there is a good chance
|
||||||
|
@@ -64,7 +64,7 @@ void ast_unregister_atexit(void (*func)(void));
|
|||||||
/*!
|
/*!
|
||||||
* \brief Register the version of a source code file with the core.
|
* \brief Register the version of a source code file with the core.
|
||||||
* \param file the source file name
|
* \param file the source file name
|
||||||
* \param version the version string (typically a CVS revision keyword string)
|
* \param version the version string (typically a SVN revision keyword string)
|
||||||
* \return nothing
|
* \return nothing
|
||||||
*
|
*
|
||||||
* This function should not be called directly, but instead the
|
* This function should not be called directly, but instead the
|
||||||
@@ -94,7 +94,7 @@ char *ast_complete_source_filename(const char *partial, int n);
|
|||||||
/*!
|
/*!
|
||||||
* \brief Register/unregister a source code file with the core.
|
* \brief Register/unregister a source code file with the core.
|
||||||
* \param file the source file name
|
* \param file the source file name
|
||||||
* \param version the version string (typically a CVS revision keyword string)
|
* \param version the version string (typically a SVN revision keyword string)
|
||||||
*
|
*
|
||||||
* This macro will place a file-scope constructor and destructor into the
|
* This macro will place a file-scope constructor and destructor into the
|
||||||
* source of the module using it; this will cause the version of this file
|
* source of the module using it; this will cause the version of this file
|
||||||
@@ -108,8 +108,8 @@ char *ast_complete_source_filename(const char *partial, int n);
|
|||||||
* \endcode
|
* \endcode
|
||||||
*
|
*
|
||||||
* \note The dollar signs above have been protected with backslashes to keep
|
* \note The dollar signs above have been protected with backslashes to keep
|
||||||
* CVS from modifying them in this file; under normal circumstances they would
|
* SVN from modifying them in this file; under normal circumstances they would
|
||||||
* not be present and CVS would expand the Revision keyword into the file's
|
* not be present and SVN would expand the Revision keyword into the file's
|
||||||
* revision number.
|
* revision number.
|
||||||
*/
|
*/
|
||||||
#ifdef MTX_PROFILE
|
#ifdef MTX_PROFILE
|
||||||
|
Reference in New Issue
Block a user