source: rtems/cpukit/httpd/value.c @ 9b05600

4.104.114.84.95
Last change on this file since 9b05600 was c1cdaa0, checked in by Joel Sherrill <joel.sherrill@…>, on 10/27/99 at 12:50:33

Patch from Emmanuel Raguet <raguet@…> and Eric Valette
<valette@…> to add a port of the GoAhead? web server
(httpd) to the RTEMS build tree. They have successfully used
this BSP on i386/pc386 and PowerPC/mcp750.

Mark and Joel spoke with Nick Berliner <nickb@…> on
26 Oct 1999 about this port and got verbal approval to include
it in RTEMS distributions.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 * value.c -- Generic type (holds all types)
3 *
4 * Copyright (c) Go Ahead Software, Inc., 1995-1999
5 *
6 * See the file "license.txt" for usage and redistribution license requirements
7 */
8
9/******************************** Description *********************************/
10
11/*
12 *      This module provides a generic type that can hold all possible types.
13 *      It is designed to provide maximum effeciency.
14 */
15
16/********************************* Includes ***********************************/
17
18#include        "uemf.h"
19
20/*********************************** Locals ***********************************/
21
22
23/*********************************** Code *************************************/
24/*
25 *      Initialize a integer value. 
26 */
27
28value_t valueInteger(long value)
29{
30        value_t v = VALUE_VALID;
31
32        v.value.integer = value;
33        return v;
34}
35
36/******************************************************************************/
37/*
38 *      Initialize a string value. Note: not allocation
39 */
40
41value_t valueString(char_t *value, int flags)
42{
43        value_t v = VALUE_VALID;
44
45        v.type = string;
46        if (flags & VALUE_ALLOCATE) {
47                v.allocated = 1;
48                v.value.string = gstrdup(B_L, value);
49        } else {
50                v.allocated = 0;
51                v.value.string = value;
52        }
53        return v;
54}
55
56/******************************************************************************/
57/*
58 *      Free any storage allocated for a value. 
59 */
60
61void valueFree(value_t *v)
62{
63        a_assert(v);
64
65        if (v->valid && v->allocated && v->type == string &&
66                        v->value.string != NULL) {
67                bfree(B_L, v->value.string);
68        }
69        v->type = undefined;
70        v->valid = 0;
71        v->allocated = 0;
72}
73
74/******************************************************************************/
Note: See TracBrowser for help on using the repository browser.