summaryrefslogtreecommitdiff
path: root/CODING_STANDARDS
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-01-26 17:21:14 -0800
committerStanislav Malyshev <stas@php.net>2014-01-26 17:21:14 -0800
commit223a62d69eeace864cb5deb45e3a56eb3ac3beaa (patch)
tree36531bbdda12e31f7db99ec11c6f628ef85d37a4 /CODING_STANDARDS
parent561317898c2c531bc9f91c8747cc0458b4c88e97 (diff)
parentfed80ee605df24c4fe70f09b77cb2551fdf47d79 (diff)
downloadphp-git-223a62d69eeace864cb5deb45e3a56eb3ac3beaa.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fix English and improve by Stas. Thanks :) Update source docs Revert "Update source docs" Update source docs Conflicts: README.EXTENSIONS
Diffstat (limited to 'CODING_STANDARDS')
-rw-r--r--CODING_STANDARDS26
1 files changed, 23 insertions, 3 deletions
diff --git a/CODING_STANDARDS b/CODING_STANDARDS
index 5fd3f9f35a..27fff07f60 100644
--- a/CODING_STANDARDS
+++ b/CODING_STANDARDS
@@ -82,7 +82,7 @@ Exceptions:
library may need to control or free the memory, or when the memory in
question needs to survive between multiple requests.
-Naming Conventions
+User Functions/Methods Naming Conventions
------------------
1. Function names for user-level functions should be enclosed with in
@@ -163,6 +163,26 @@ Naming Conventions
'foobar'
'foo_bar'
+Internal Function Naming Convensions
+----------------------
+
+1. Functions that are part of the external API should be named
+ 'php_modulename_function()' to avoid symbol collision. They should be in
+ lowercase, with words underscore delimited. Exposed API must be defined
+ in 'php_modulename.h'.
+
+ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS);
+
+ Unexposed module function should be static and should not be defined in
+ 'php_modulename.h'.
+
+ static int php_session_destroy(TSRMLS_D)
+
+2. Main module source file must be named 'modulename.c'.
+
+3. Header file that is used by other sources must be named 'php_modulename.h'.
+
+
Syntax and indentation
----------------------
@@ -181,9 +201,9 @@ Syntax and indentation
of PHP or one of its standard modules, please maintain the K&R
style. This applies to just about everything, starting with
indentation and comment styles and up to function declaration
- syntax. Also see Indentstyle_.
+ syntax. Also see Indentstyle.
-.. _Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
+ Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
3. Be generous with whitespace and braces. Keep one empty line between the
variable declaration section and the statements in a block, as well as