Skip to content

Commit c150f9b

Browse files
[python, Bridge] Fix formatting issues
1 parent f908d32 commit c150f9b

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

lang_python/oif_impl/bridge_python.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ load_impl(const char *impl_details, size_t version_major, size_t version_minor)
208208

209209
ImplInfo *result = NULL;
210210
int status;
211-
int nbytes_required; // Number of required bytes in snprintf.
212-
int nbytes_written; // Number of written bytes in snprintf.
213-
char *cmd; // Command formatted in snprintf.
211+
int nbytes_required; // Number of required bytes in snprintf.
212+
int nbytes_written; // Number of written bytes in snprintf.
213+
char *cmd; // Command formatted in snprintf.
214214

215215
(void)version_major;
216216
(void)version_minor;
@@ -264,15 +264,16 @@ load_impl(const char *impl_details, size_t version_major, size_t version_minor)
264264
return NULL;
265265
}
266266

267-
nbytes_written = snprintf(libpython_path, sizeof libpython_path, "%s", PyUnicode_AsUTF8(pValue));
267+
nbytes_written =
268+
snprintf(libpython_path, sizeof libpython_path, "%s", PyUnicode_AsUTF8(pValue));
268269
if (nbytes_written < 0 || nbytes_written >= sizeof libpython_path) {
269270
logerr(prefix_, "Could not convert path to `libpython`");
270271
goto cleanup;
271272
}
272273

273274
fprintf(stderr, "[%s] libpython path: %s\n", prefix_, libpython_path);
274-
nbytes_written = snprintf(libpython_name, sizeof libpython_name, "%s/libpython%d.%d%s", libpython_path, PY_MAJOR_VERSION,
275-
PY_MINOR_VERSION, SHLIB_EXT);
275+
nbytes_written = snprintf(libpython_name, sizeof libpython_name, "%s/libpython%d.%d%s",
276+
libpython_path, PY_MAJOR_VERSION, PY_MINOR_VERSION, SHLIB_EXT);
276277
if (nbytes_written < 0 || nbytes_written >= sizeof libpython_name) {
277278
logerr(prefix_, "Could not build a filepath to the Python library");
278279
goto cleanup;
@@ -290,10 +291,10 @@ load_impl(const char *impl_details, size_t version_major, size_t version_minor)
290291
"print('[%s]', sys.version)";
291292
nbytes_required = snprintf(NULL, 0, cmd_sys_info, prefix_, prefix_) + 1;
292293
cmd = malloc(sizeof(char) * nbytes_required);
293-
nbytes_written = snprintf(cmd, nbytes_required, cmd_sys_info,
294-
prefix_, prefix_);
294+
nbytes_written = snprintf(cmd, nbytes_required, cmd_sys_info, prefix_, prefix_);
295295
if (nbytes_written < 0 || nbytes_written >= nbytes_required) {
296-
logerr(prefix_, "An error occurred in formatting a string as a command for Python interpreter");
296+
logerr(prefix_,
297+
"An error occurred in formatting a string as a command for Python interpreter");
297298
goto cleanup;
298299
}
299300
status = PyRun_SimpleString(cmd);
@@ -305,15 +306,15 @@ load_impl(const char *impl_details, size_t version_major, size_t version_minor)
305306

306307
import_array2("Failed to initialize NumPy C API", NULL);
307308

308-
const char *cmd_numpy_fmt = "import numpy; "
309+
const char *cmd_numpy_fmt =
310+
"import numpy; "
309311
"print('[%s] NumPy version: ', numpy.__version__)";
310312
nbytes_required = snprintf(NULL, 0, cmd_numpy_fmt, prefix_) + 1;
311313
cmd = malloc(sizeof(char) * nbytes_required);
312-
nbytes_written = snprintf(
313-
cmd, nbytes_required, cmd_numpy_fmt, prefix_
314-
);
314+
nbytes_written = snprintf(cmd, nbytes_required, cmd_numpy_fmt, prefix_);
315315
if (nbytes_written < 0 || nbytes_written >= nbytes_required) {
316-
logerr(prefix_, "An error occurred in formatting a string as a command for Python interpreter");
316+
logerr(prefix_,
317+
"An error occurred in formatting a string as a command for Python interpreter");
317318
goto cleanup;
318319
}
319320
status = PyRun_SimpleString(cmd);

0 commit comments

Comments
 (0)