pyldb: avoid segfault when adding an element with no name
[sfrench/samba-autobuild/.git] / lib / util / util.h
1 /* 
2    Unix SMB/CIFS implementation.
3    Utility functions for Samba
4    Copyright (C) Andrew Tridgell 1992-1999
5    Copyright (C) Jelmer Vernooij 2005
6     
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __UTIL_SAMBA_UTIL_H__
22 #define __UTIL_SAMBA_UTIL_H__
23
24 unsigned long int
25 strtoul_err(const char *nptr, char **endptr, int base, int *err);
26
27 unsigned long long int
28 strtoull_err(const char *nptr, char **endptr, int base, int *err);
29
30
31 /**
32  * Write dump of binary data to a callback
33  */
34 void dump_data_cb(const uint8_t *buf, int len,
35                   bool omit_zero_bytes,
36                   void (*cb)(const char *buf, void *private_data),
37                   void *private_data);
38
39 /**
40  * Write dump of binary data to a FILE
41  */
42 void dump_data_file(const uint8_t *buf, int len, bool omit_zero_bytes,
43                     FILE *f);
44
45 /**
46  * Write dump of binary data to the log file.
47  *
48  * The data is only written if the log level is at least level.
49  */
50 _PUBLIC_ void dump_data(int level, const uint8_t *buf,int len);
51
52 /**
53  * Write dump of binary data to the log file.
54  *
55  * The data is only written if the log level is at least level for
56  * debug class dbgc_class.
57  */
58 _PUBLIC_ void dump_data_dbgc(int dbgc_class, int level, const uint8_t *buf, int len);
59
60 #endif