File: uuid.c

package info (click to toggle)
e2fsprogs 1.47.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,040 kB
  • sloc: ansic: 132,791; sh: 7,273; makefile: 5,315; awk: 524; perl: 376; cpp: 207; sed: 186; python: 23
file content (23 lines) | stat: -rw-r--r-- 510 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <Python.h>
#include <time.h>
#include <uuid/uuid.h>

static PyObject * _uuid_generate(PyObject *self, PyObject *args)
{
  uuid_t u;
  char uuid[37];
  if (!PyArg_ParseTuple(args, "")) return NULL;
  uuid_generate(u);
  uuid_unparse(u, uuid);
  return Py_BuildValue("s", uuid);
}

static PyMethodDef _uuid_methods[] = {
  {"generate", _uuid_generate, METH_VARARGS, "Generate UUID"},
  {NULL, NULL, 0, NULL}
};

void inite2fsprogs_uuid(void)
{
  (void) Py_InitModule("e2fsprogs_uuid", _uuid_methods);
}