Navigation



Ignore:
Timestamp:
Feb 24, 2011, 10:48:05 AM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Add new wrapper to create events from int values (useful for FDEV_TRIGGER events)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_interactive/events.i

    r640 r728  
    4646                }
    4747                fd->code = code;
    48                 fd->data = STRING; /* Should maybe malloc it ? */
     48                fd->data = os0dup(STRING, LENGTH);
     49                if (!fd->data) {
     50                        DI_ERROR_MALLOC;
     51                        return NULL;
     52                };
    4953                fd->size = LENGTH;
    5054                return fd;
    5155        }
     56       
     57        fd_event(int code, int value) {
     58                struct fd_event * fd = calloc(1, sizeof(struct fd_event));
     59                if (!fd) {
     60                        DI_ERROR_MALLOC;
     61                        return NULL;
     62                }
     63                fd->code = code;
     64                fd->data = malloc(sizeof(int));
     65                if (!fd->data) {
     66                        DI_ERROR_MALLOC;
     67                        return NULL;
     68                };
     69                *((int *)fd->data) = value;
     70                fd->size = sizeof(int);
     71                return fd;
     72        }
    5273}       
Note: See TracChangeset for help on using the changeset viewer.