jon Thu Oct 10 13:03:49 2002 EDT
Modified files:
/php4 CODING_STANDARDS
Log:
Adding a new item (number 11) that explains why it's important to use
emalloc() and friends in place of the standard C library functions.
Index: php4/CODING_STANDARDS
diff -u php4/CODING_STANDARDS:1.22 php4/CODING_STANDARDS:1.23
--- php4/CODING_STANDARDS:1.22 Mon Sep 9 03:54:11 2002
+++ php4/CODING_STANDARDS Thu Oct 10 13:03:49 2002
@@ -122,6 +122,19 @@
existing. End users should use function_exists() to test for the
existence of a function
+[11] Prefer emalloc(), efree(), estrdup(), etc. to their standard C library
+ counterparts. These functions implement an internal "safety-net"
+ mechanism that ensures the deallocation of any unfreed memory at the
+ end of a request. They also provide useful allocation and overflow
+ information while running in debug mode.
+
+ In almost all cases, memory returned to the engine must be allocated
+ using emalloc().
+
+ The use of malloc() should be limited to cases where a third-party
+ library may need to control or free the memory, or when the memory in
+ question needs to survive between multiple requests.
+
Naming Conventions
------------------
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php