modified: myjupyterlab.sh
[GalaxyCodeBases.git] / c_cpp / lib / uthash / src / utmm.h
blob82681d76306c67f2e1d60a8d97364a2175ed5ab6
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 /*
5 Copyright (c) 2003-2016, Troy D. Hanson http://troydhanson.github.com/uthash/
6 All rights reserved.
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
11 * Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
15 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
17 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
18 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 /* utmm
29 * low level memory primitives
33 #ifndef __UTMM_H_
34 #define __UTMM_H_
37 typedef struct {
38 size_t sz;
39 void (*init)(void *buf); //-> utstring-init
40 void (*fini)(void *buf); //-> utstring-done
41 void (*copy)(void *dst, void *src); //-> ustring_concat
42 void (*clear)(void *buf); //-> utstring-clear
43 } UT_mm;
45 void *utmm_new(const UT_mm *mm, size_t n);
46 void utmm_init(const UT_mm *mm, void *buf, size_t n);
47 void utmm_fini(const UT_mm *mm, void *buf, size_t n);
48 void utmm_clear(const UT_mm *mm, void *buf, size_t n);
49 void utmm_copy(const UT_mm *mm, void *dst, void *src, size_t n);
51 /* convenient predefined mm */
52 extern UT_mm* utmm_int;
53 extern UT_mm* utstring_mm;
55 #endif /* __UTMM_H_ */