Re: Re: Module function API naming conventions

From: Date: Fri, 24 Jan 2014 22:35:07 +0000
Subject: Re: Re: Module function API naming conventions
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-71535@lists.php.net to get a copy of this message

On 01/24/2014 02:09 PM, Yasuo Ohgaki wrote:
Hi all, On Fri, Jan 24, 2014 at 7:41 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
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?
It seems no comments for this. This is mandatory. IMHO. I'll commit this 5.4 and up today. If there are corrections/additions, please update. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net
Can you make it more explicit with an example to show what an "exposed module API" would look like? This doc will be read by people not familiar with PHP internals. Is there anything in ext/ext_skel or the manual that needs to be kept in sync with your changes? Chris -- christopher.jones@oracle.com http://twitter.com/ghrd Free PHP & Oracle book: http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

Thread (8 messages)

« previous php.internals (#71535) next »