Navigation



Ignore:
Timestamp:
May 5, 2013, 4:25:27 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_interactive/sessions.i

    r1013 r1088  
    3939
    4040%{
     41struct sess_state {
     42        PyObject * pystate;
     43};
     44
    4145/* call it (might be called from a different thread than the interpreter, when session times out) */
    42 static void call_the_python_cleanup_callback(session_state * state, os0_t sid, void * cb) {
     46static void call_the_python_cleanup_callback(struct sess_state * state, os0_t sid, void * cb) {
    4347        PyObject *result;
    4448        if (!cb) {
     
    6771                Py_XINCREF(PyCb);
    6872               
    69                 ret = fd_sess_handler_create_internal ( &hdl, call_the_python_cleanup_callback, PyCb );
     73                ret = fd_sess_handler_create ( &hdl, call_the_python_cleanup_callback, NULL, PyCb );
    7074                if (ret != 0) {
    7175                        DI_ERROR(ret, NULL, NULL);
     
    8791        }
    8892        void dump() {
    89                 fd_sess_dump_hdl(0, $self);
     93                char * buf = NULL;
     94                size_t len;
     95                printf("%s", fd_sess_dump_hdl(&buf, &len, NULL, $self));
     96                free(buf);
    9097        }
    9198}
     
    166173        }
    167174        void dump() {
    168                 fd_sess_dump(0, $self);
     175                char * buf = NULL;
     176                size_t len = 0;
     177                printf("%s", fd_sess_dump(&buf, &len, NULL, $self, 1) );
     178                free(buf);
    169179        }
    170180        void store(struct session_handler * handler, PyObject * DISOWN) {
    171181                int ret;
    172                 void * store = DISOWN;
     182                struct sess_state * st = NULL;
     183                st = malloc(sizeof(struct sess_state));
     184                st->pystate = DISOWN;
    173185                Py_XINCREF(DISOWN);
    174                 ret = fd_sess_state_store_internal(handler, $self, (void *) &store);
     186                ret = fd_sess_state_store(handler, $self, (void *) &st);
    175187                if (ret != 0) {
    176188                        DI_ERROR(ret, NULL, NULL);
     
    180192        PyObject * retrieve(struct session_handler * handler) {
    181193                int ret;
     194                struct sess_state * st = NULL;
    182195                PyObject * state = NULL;
    183                 ret = fd_sess_state_retrieve_internal(handler, $self, (void *) &state);
    184                 if (ret != 0) {
    185                         DI_ERROR(ret, NULL, NULL);
    186                         return NULL;
    187                 }
    188                 if (state == NULL) {
     196                ret = fd_sess_state_retrieve_internal(handler, $self, (void *) &st);
     197                if (ret != 0) {
     198                        DI_ERROR(ret, NULL, NULL);
     199                        return NULL;
     200                }
     201                if (st == NULL) {
    189202                        Py_INCREF(Py_None);
    190203                        return Py_None;
    191204                }
     205                state = st->pystate;
     206                free(st);
    192207                return state;
    193208        }
Note: See TracChangeset for help on using the changeset viewer.