Cleanup: move doc-strings into headers, remove duplicates

In some cases move implementation details into the function body.
This commit is contained in:
2023-03-29 14:16:31 +11:00
parent ce659dbc4e
commit 1ddbe7cadd
100 changed files with 339 additions and 348 deletions

View File

@@ -536,7 +536,6 @@ const char *PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *ite
return NULL;
}
/* Silly function, we don't use arg. just check its compatible with `__deepcopy__`. */
int PyC_CheckArgs_DeepCopy(PyObject *args)
{
PyObject *dummy_pydict;
@@ -553,7 +552,6 @@ int PyC_CheckArgs_DeepCopy(PyObject *args)
* These are useful to run directly from a debugger to be able to inspect the state.
* \{ */
/* for debugging */
void PyC_ObSpit(const char *name, PyObject *var)
{
const char *null_str = "<null>";
@@ -707,9 +705,10 @@ void PyC_FileAndNum_Safe(const char **r_filename, int *r_lineno)
/** \name Object Access Utilities
* \{ */
/* Would be nice if python had this built in */
PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
{
/* NOTE: Would be nice if python had this built in. */
Py_ssize_t i;
PyObject *item = o;
const char *attr;
@@ -1154,11 +1153,11 @@ bool PyC_IsInterpreterActive(void)
/** \name #Py_SetPythonHome Wrapper
* \{ */
/* Would be nice if python had this built in
* See: https://wiki.blender.org/wiki/Tools/Debugging/PyFromC
*/
void PyC_RunQuicky(const char *filepath, int n, ...)
{
/* NOTE: Would be nice if python had this built in
* See: https://wiki.blender.org/wiki/Tools/Debugging/PyFromC */
FILE *fp = fopen(filepath, "r");
if (fp) {
@@ -1303,7 +1302,6 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
}
}
/* generic function to avoid depending on RNA */
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name)
{
PyObject *as_pointer;

View File

@@ -15,6 +15,7 @@ extern "C" {
#include "BLI_sys_types.h"
#include "BLI_utildefines_variadic.h"
/** Useful to print Python objects while debugging. */
void PyC_ObSpit(const char *name, PyObject *var);
/**
* A version of #PyC_ObSpit that writes into a string (and doesn't take a name argument).
@@ -146,6 +147,9 @@ void PyC_MainModule_Restore(PyObject *main_mod);
bool PyC_IsInterpreterActive(void);
/**
* Generic function to avoid depending on RNA.
*/
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name);
/* flag / set --- interchange */
@@ -211,6 +215,9 @@ struct PyC_StringEnum {
int PyC_ParseStringEnum(PyObject *o, void *p);
const char *PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items, int value);
/**
* Silly function, we don't use arg. just check its compatible with `__deepcopy__`.
*/
int PyC_CheckArgs_DeepCopy(PyObject *args);
/* Integer parsing (with overflow checks), -1 on error. */