| 366 | } |
| 367 | |
| 368 | static PyObject * |
| 369 | msg_get_pseudoVar(msgobject *self, PyObject *args) |
| 370 | { |
| 371 | str hmodel,rval; |
| 372 | pv_elem_t *model; |
| 373 | int buf_size = 4096; |
| 374 | char *out; |
| 375 | PyObject * res; |
| 376 | |
| 377 | if (self->msg == NULL) { |
| 378 | PyErr_SetString(PyExc_RuntimeError, "self->msg is NULL"); |
| 379 | Py_INCREF(Py_None); |
| 380 | return Py_None; |
| 381 | } |
| 382 | |
| 383 | if(!PyArg_ParseTuple(args, "s", &hmodel.s)){ |
| 384 | Py_INCREF(Py_None); |
| 385 | return Py_None; |
| 386 | } |
| 387 | |
| 388 | hmodel.len = strlen(hmodel.s); |
| 389 | if (pv_parse_format(&hmodel, &model) < 0) |
| 390 | { |
| 391 | Py_INCREF(Py_None); |
| 392 | return Py_None; |
| 393 | } |
| 394 | |
| 395 | out = pkg_malloc(buf_size); |
| 396 | if (!out) |
| 397 | { |
| 398 | PyErr_SetString(PyExc_RuntimeError, "Not enough memor"); |
| 399 | Py_INCREF(Py_None); |
| 400 | return Py_None; |
| 401 | } |
| 402 | |
| 403 | rval.len = pv_printf(self->msg, model, out, &buf_size) ; |
| 404 | rval.s = out; |
| 405 | rval.len = strlen(rval.s); |
| 406 | res = PyUnicode_FromStringAndSize(rval.s, rval.len); |
| 407 | pkg_free(out); |
| 408 | pv_elem_free_all(model); |
| 409 | return res; |
| 410 | } |
| 411 | |
| 412 | static PyObject * |
| 413 | msg_set_pseudoVar(msgobject *self, PyObject *args) |
nothing calls this directly
no test coverage detected