FreeRDP
uwac-utils.c
1
/*
2
* Copyright © 2012 Collabora, Ltd.
3
* Copyright © 2008 Kristian Høgsberg
4
* Copyright © 2014 David FORT <contact@hardening-consulting.com>
5
*
6
* Permission to use, copy, modify, distribute, and sell this software and its
7
* documentation for any purpose is hereby granted without fee, provided that
8
* the above copyright notice appear in all copies and that both that copyright
9
* notice and this permission notice appear in supporting documentation, and
10
* that the name of the copyright holders not be used in advertising or
11
* publicity pertaining to distribution of the software without specific,
12
* written prior permission. The copyright holders make no representations
13
* about the suitability of this software for any purpose. It is provided "as
14
* is" without express or implied warranty.
15
*
16
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22
* OF THIS SOFTWARE.
23
*/
24
25
#include <uwac/config.h>
26
27
#include <stdlib.h>
28
#include <stdio.h>
29
#include <string.h>
30
#include <errno.h>
31
32
#include "uwac-utils.h"
33
34
/*
35
* This part is an adaptation of client/window.c from the weston project.
36
*/
37
38
static
void
* fail_on_null(
void
* p)
39
{
40
if
(p == NULL)
41
{
42
(void)fprintf(stderr,
"out of memory\n"
);
43
exit(EXIT_FAILURE);
44
}
45
46
return
p;
47
}
48
49
void
* xmalloc(
size_t
s)
50
{
51
return
fail_on_null(malloc(s));
52
}
53
54
void
* xzalloc(
size_t
s)
55
{
56
return
fail_on_null(zalloc(s));
57
}
58
59
char
* xstrdup(
const
char
* s)
60
{
61
return
fail_on_null(strdup(s));
62
}
63
64
void
* xrealloc(
void
* p,
size_t
s)
65
{
66
return
fail_on_null(realloc(p, s));
67
}
uwac
libuwac
uwac-utils.c
Generated by
1.9.1