GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_widget_allocate.c Lines: 8 8 100.0 %
Date: 2024-12-05 08:52:37 Branches: 6 6 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 *
4
 * This program and the accompanying materials are made available under the
5
 * terms of the MIT License which is available at
6
 * https://opensource.org/licenses/MIT.
7
 *
8
 * SPDX-License-Identifier: MIT
9
 **************************************************************************/
10
11
12
/**************************************************************************/
13
/**************************************************************************/
14
/**                                                                       */
15
/** GUIX Component                                                        */
16
/**                                                                       */
17
/**   Widget Management (Widget)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
/* Include necessary system files.  */
24
25
#include "gx_api.h"
26
#include "gx_system.h"
27
#include "gx_widget.h"
28
#include "gx_utility.h"
29
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gxe_widget_allocate                                PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function allocates memory for a widget control block           */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    widget                                Return pointer for widget     */
48
/*                                            control block.              */
49
/*    memsize                               Size of control block.        */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_widget_allocate                   Actual widget allocation call */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    Application Code                                                    */
62
/*                                                                        */
63
/*  RELEASE HISTORY                                                       */
64
/*                                                                        */
65
/*    DATE              NAME                      DESCRIPTION             */
66
/*                                                                        */
67
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
68
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
69
/*                                            resulting in version 6.1    */
70
/*                                                                        */
71
/**************************************************************************/
72
706
UINT  _gxe_widget_allocate(GX_WIDGET **widget, ULONG memsize)
73
{
74
706
    if (!_gx_system_memory_allocator)
75
    {
76
2
        return GX_SYSTEM_MEMORY_ERROR;
77
    }
78
79
704
    if (!widget)
80
    {
81
1
        return GX_PTR_ERROR;
82
    }
83
703
    if (!memsize)
84
    {
85
1
        return GX_INVALID_MEMORY_SIZE;
86
    }
87
702
    return _gx_widget_allocate(widget, memsize);
88
}
89