File: saml-util.h

package info (click to toggle)
saml 970418-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,204 kB
  • ctags: 1,701
  • sloc: ansic: 17,182; sh: 2,583; yacc: 497; perl: 264; makefile: 250; python: 242
file content (52 lines) | stat: -rw-r--r-- 1,124 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright 1996 Thierry Bousch
 * Licensed under the Gnu Public License, Version 2
 *
 * $Id: saml-util.h,v 1.3 1996/05/01 09:34:27 bousch Exp $
 *
 * Various utility routines
 */

#ifndef _SAML_UTIL_H
#define _SAML_UTIL_H

#include <stddef.h>
#ifdef __linux__
#include <asm/types.h>
#else
typedef unsigned char      __u8;
typedef unsigned short     __u16;
typedef unsigned int       __u32;
#ifdef __alpha__
typedef unsigned long      __u64;
#else
typedef unsigned long long __u64;
#endif
#endif

/* Growable strings */

typedef struct _growable_string {
	size_t	buflen;
	size_t	len;
	char	s[0];
} gr_string;

gr_string* new_gr_string (size_t initial_length);
gr_string* grs_append (gr_string* dest, const char* src, size_t len);
gr_string* grs_prepend (gr_string* dest, const char* src, size_t len);
gr_string* grs_append1 (gr_string* dest, char c);
gr_string* grs_prepend1 (gr_string* dest, char c);

/* Panics */

#define EXITING __attribute__((noreturn))
void saml_panic(const char *message) EXITING;
void panic_out_of_memory(void) EXITING;

/* Miscillaneous */

char *u32toa (__u32);
char *u64toa (__u64);

#endif