Module function API naming conventions

From: Date: Thu, 23 Jan 2014 22:41:43 +0000
Subject: Module function API naming conventions
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi all,

When I try to add dummy save handler functions for session module,
I noticed that ps_update() etc has been defined in SOAP module.

To avoid collisions, we might better to have following change in
CODING_STANDARDS.

[yohgaki@dev PHP-5.4]$ git diff
diff --git a/CODING_STANDARDS b/CODING_STANDARDS
index 7a0562e..4c67a30 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,19 @@ Naming Conventions
     'foobar'
     'foo_bar'

+Internal Function Naming Conventions
+----------------------
+
+1.  Exposed module API must have 'php_modulename_function()' to avoid
+    symbol collision. They should be in lowercase, with words
+    underscore delimited.
+
+2.  Main module source file must be named modulename.c.
+
+3.  Header file that are used by other sources than it's module must be
+    named 'php_modulename.h'.
+
+
 Syntax and indentation
 ----------------------

The rule should be applied to new modules, not existing one.
Main source and header is named like this, since ext_skel creates
files as above.

Any comments?

Regards,

--
Yasuo Ohgaki
[email protected]


Thread (8 messages)

« previous php.internals (#71468) next »