Changeset d8503fd in mainline for uspace/srv/hid/display/seat.c
- Timestamp:
- 2023-01-09T21:14:04Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46b02cb
- Parents:
- e04b72d6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/seat.c
re04b72d6 rd8503fd 39 39 #include <gfx/render.h> 40 40 #include <stdlib.h> 41 #include <str.h> 41 42 #include "client.h" 42 43 #include "cursor.h" … … 51 52 * 52 53 * @param display Parent display 54 * @param name Seat name 53 55 * @param rseat Place to store pointer to new seat. 54 56 * @return EOK on success, ENOMEM if out of memory 55 57 */ 56 errno_t ds_seat_create(ds_display_t *display, ds_seat_t **rseat) 58 errno_t ds_seat_create(ds_display_t *display, const char *name, 59 ds_seat_t **rseat) 57 60 { 58 61 ds_seat_t *seat; 62 ds_seat_t *s0; 63 64 s0 = ds_display_first_seat(display); 65 while (s0 != NULL) { 66 if (str_cmp(s0->name, name) == 0) 67 return EEXIST; 68 s0 = ds_display_next_seat(s0); 69 } 59 70 60 71 seat = calloc(1, sizeof(ds_seat_t)); … … 62 73 return ENOMEM; 63 74 75 seat->name = str_dup(name); 76 if (seat->name == NULL) { 77 free(seat); 78 return ENOMEM; 79 } 80 64 81 ds_display_add_seat(display, seat); 65 82 seat->pntpos.x = 0; … … 80 97 { 81 98 ds_display_remove_seat(seat); 99 free(seat->name); 82 100 free(seat); 83 101 }
Note:
See TracChangeset
for help on using the changeset viewer.