SQLite Forum

Explanation about C code style

Explanation about C code style

(1) By anonymous on 2021-08-23 21:38:53 [link] [source]

In malloc.c we have code of the following style:

int sqlite3_release_memory(int n){                                                                                                               
   return sqlite3PcacheReleaseMemory(n);                                                                                                          

By the way, both `...` were added for brevity.

Is the sqlite3_release_memory() function the public API interface?

What about sqlite3PcacheReleaseMemory(), is it for private use, so to speak, by the public function(s) interface?

(2) By Stephan Beal (stephan) on 2021-08-23 21:50:21 in reply to 1 [source]

Is the sqlite3_release_memory() function the public API interface?

If you can find documentation for it in the public interface then yes, else no.

What about sqlite3PcacheReleaseMemory()

The functions and data types with sqlite3CamelCaseNames are all internal, not for client-side use. They may be modified or removed by the sqlite3 developers at any time with no concerns for backwards compatibility (in strong contrast to the documented public APIs, which have strong backwards compatibility guarantees).

(3) By Larry Brasfield (larrybr) on 2021-08-23 23:37:15 in reply to 1 [link] [source]

(Just underscoring Stephan's response here.)

If you see a declaration in sqlite3.h prefixed with SQLITE_API, it is part of the "public" API. (There is no private API, so "public" is surplusage.)

The prefix SQLITE_PRIVATE on that other function, found within sqlite3.c and not otherwise exposed, is both a clue with respect to your 2nd question and an identifier which is used to confine scope to the compilation unit.