Merge branch 'upstream'
[profile/ivi/org.tizen.video-player.git] / src / harfbuzz-impl.c
1 /*
2  * Copyright (C) 1998-2004  David Turner and Werner Lemberg
3  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4  * Copyright (C) 2007  Red Hat, Inc.
5  *
6  * This is part of HarfBuzz, an OpenType Layout engine library.
7  *
8  * Permission is hereby granted, without written agreement and without
9  * license or royalty fees, to use, copy, modify, and distribute this
10  * software and its documentation for any purpose, provided that the
11  * above copyright notice and the following two paragraphs appear in
12  * all copies of this software.
13  *
14  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18  * DAMAGE.
19  *
20  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25  *
26  * Red Hat Author(s): Behdad Esfahbod
27  */
28
29 #include "harfbuzz-impl.h"
30
31
32 //HB_INTERNAL 
33 HB_Pointer
34 _hb_alloc(size_t     size,
35           HB_Error  *perror )
36 {
37   HB_Error    error = (HB_Error)0;
38   HB_Pointer  block = NULL;
39
40   if ( size > 0 )
41   {
42     block = calloc( 1, size );
43     if ( !block )
44       error = ERR_HB(HB_Err_Out_Of_Memory);
45   }
46
47   *perror = error;
48   return block;
49 }
50
51
52 //HB_INTERNAL 
53         HB_Pointer
54 _hb_realloc(HB_Pointer  block,
55             size_t      new_size,
56             HB_Error   *perror )
57 {
58     HB_Pointer  block2 = NULL;
59     HB_Error    error  = (HB_Error)0;
60
61     block2 = realloc( block, new_size );
62     if ( block2 == NULL && new_size != 0 )
63         error = ERR_HB(HB_Err_Out_Of_Memory);
64
65     if ( !error )
66         block = block2;
67
68     *perror = error;
69     return block;
70 }
71
72
73 //HB_INTERNAL 
74         void
75 _hb_free( HB_Pointer  block )
76 {
77   if ( block )
78     free( block );
79 }
80
81
82 /* helper func to set a breakpoint on */
83 //HB_INTERNAL 
84 HB_Error
85 _hb_err(HB_Error code)
86 {
87   return code;
88 }