]>
git.proxmox.com Git - libgit2.git/blob - script/user_model.c
2 * Copyright (C) the libgit2 contributors. All rights reserved.
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
8 void *realloc(void *ptr
, size_t size
);
9 void *memmove(void *dest
, const void *src
, size_t n
);
10 size_t strlen(const char *s
);
12 typedef struct va_list_str
*va_list;
14 typedef struct git_vector
{
19 typedef struct git_buf
{
24 int git_vector_insert(git_vector
*v
, void *element
)
29 v
->contents
= realloc(v
->contents
, ++v
->length
);
32 v
->contents
[v
->length
] = element
;
37 int git_buf_len(const struct git_buf
*buf
)
39 return strlen(buf
->ptr
);
42 int git_buf_vprintf(git_buf
*buf
, const char *format
, va_list ap
)
47 __coverity_string_null_sink__(format
);
48 __coverity_string_size_sink__(format
);
53 buf
->ptr
= __coverity_alloc__(len
);
54 __coverity_writeall__(buf
->ptr
);
60 int git_buf_put(git_buf
*buf
, const char *data
, size_t len
)
62 buf
->ptr
= __coverity_alloc__(buf
->size
+ len
+ 1);
63 memmove(buf
->ptr
+ buf
->size
, data
, len
);
65 buf
->ptr
[buf
->size
+ len
] = 0;
69 int git_buf_set(git_buf
*buf
, const void *data
, size_t len
)
71 buf
->ptr
= __coverity_alloc__(len
+ 1);
72 memmove(buf
->ptr
, data
, len
);
81 const char *description
,
93 const char *description
,
96 if (!condition
&& should_abort
)