Re: Module function API naming conventions

From: Date: Fri, 24 Jan 2014 22:09:44 +0000
Subject: Re: Module function API naming conventions
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-71534@lists.php.net to get a copy of this message
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

« previous php.internals (#71534) next »