libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xchildlist_private.c
Go to the documentation of this file.
1 /*
2  * 0BSD
3  *
4  * BSD Zero Clause License
5  *
6  * Copyright (c) 2019 Hermann Meyer
7  *
8  * Permission to use, copy, modify, and/or distribute this software for any
9  * purpose with or without fee is hereby granted.
10 
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  *
19  */
20 
21 #include "xchildlist_private.h"
22 
23 void _childlist_add_elem(Childlist_t *childlist) {
24  childlist->childs = (Widget_t**)realloc(childlist->childs, sizeof(Widget_t*) * (4+childlist->cap));
25  assert(childlist->childs != NULL);
26  childlist->cap +=4;
27  childlist->size = sizeof(childlist);
28  int i = childlist->elem+1;
29  for(;i<childlist->cap;i++) {
30  childlist->childs[i] = NULL;
31  }
32 }
Childlist_t::childs
Widget_t ** childs
Definition: xchildlist.h:51
xchildlist_private.h
Childlist_t::cap
int cap
Definition: xchildlist.h:55
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
Childlist_t
Childlist_t - struct to hold a Widget_t child list Xputty main holds a list of any Widget_t created...
Definition: xchildlist.h:49
Childlist_t::size
size_t size
Definition: xchildlist.h:53
Childlist_t::elem
int elem
Definition: xchildlist.h:57
_childlist_add_elem
void _childlist_add_elem(Childlist_t *childlist)
_childlist_add_elem - internal use to reallocate the childlist array to new size You didn't need to...
Definition: xchildlist_private.c:23