-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add core functions in python C extensions.
Add common functions to a single file reused by all C extensions.
- Loading branch information
1 parent
7aba4ce
commit 31f96b2
Showing
3 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "_core.h" | ||
|
||
Py_buffer newbuffer_like(Py_buffer *buffer){ | ||
Py_buffer newbuffer; | ||
newbuffer.buf = PyMem_Malloc(buffer->len); | ||
newbuffer.obj = NULL; | ||
newbuffer.len = buffer->len; | ||
newbuffer.readonly = buffer->readonly; | ||
newbuffer.itemsize = buffer->itemsize; | ||
newbuffer.format = buffer->format; | ||
newbuffer.ndim = buffer->ndim; | ||
newbuffer.shape = buffer->shape; | ||
newbuffer.strides = buffer->strides; | ||
newbuffer.suboffsets = NULL; | ||
|
||
return newbuffer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef _CORE_H | ||
#define _CORE_H | ||
#include <Python.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include "iapws.h" | ||
|
||
Py_buffer newbuffer_like(Py_buffer *buffer); | ||
|
||
|
||
#endif |