tools/trace-malloc/formdata.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial