tools/trace-malloc/formdata.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:2498c0330c3f
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #if !defined(__formdata_H__)
8 #define __formdata_H__
9
10 /*
11 ** formdata.h
12 **
13 ** Play (quick and dirty) utility API to parse up form get data into
14 ** name value pairs.
15 */
16
17 typedef struct __struct_FormData
18 /*
19 ** Structure to hold the breakdown of any form data.
20 **
21 ** mNArray Each form datum is a name value pair.
22 ** This array holds the names.
23 ** You can find the corresponding value at the same index in
24 ** mVArray.
25 ** Never NULL, but perhpas an empty string.
26 ** mVArray Each form datum is a name value pair.
27 ** This array holds the values.
28 ** You can find the corresponding name at the same index in
29 ** mNArray.
30 ** Never NULL, but perhpas an empty string.
31 ** mNVCount Count of array items in both mNArray and mVArray.
32 ** mStorage Should be ignored by users of this API.
33 ** In reality holds the duped and decoded form data.
34 */
35 {
36 char** mNArray;
37 char** mVArray;
38 unsigned mNVCount;
39 char* mStorage;
40 }
41 FormData;
42
43 FormData* FormData_Create(const char* inFormData)
44 /*
45 ** Take a contiguous string of form data, possibly hex encoded, and return
46 ** the name value pairs parsed up and decoded.
47 ** A caller of this routine should call FormData_Destroy at some point.
48 **
49 ** inFormData The form data to parse up and decode.
50 ** returns FormData* The result of our effort.
51 ** This should be passed to FormData_Destroy at some
52 ** point of the memory will be leaked.
53 */
54 ;
55
56 void FormData_Destroy(FormData* inDestroy)
57 /*
58 ** Release to the heap the structure previously created via FormData_Create.
59 **
60 ** inDestroy The object to free off.
61 */
62 ;
63
64 #endif /* __formdata_H__ */

mercurial