mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Minor bug fixes.
Enhanced function docs.
This commit is contained in:
parent
e1f6e32da0
commit
44add1c310
@ -1,3 +1,9 @@
|
||||
2009-07-07 Werner Koch <wk@g10code.com>
|
||||
|
||||
* stringhelp.c (make_filename_try): Use jnlib_malloc.
|
||||
|
||||
* dotlock.c (read_lockfile): Replace jnlib_xmalloc by jnlib_malloc.
|
||||
|
||||
2009-06-04 Werner Koch <wk@g10code.com>
|
||||
|
||||
* mischelp.h: Include SUN_LEN etc also for W32.
|
||||
|
@ -598,7 +598,11 @@ read_lockfile (DOTLOCK h, int *same_node )
|
||||
*same_node = 0;
|
||||
expected_len = 10 + 1 + h->nodename_len + 1;
|
||||
if ( expected_len >= sizeof buffer_space)
|
||||
buffer = jnlib_xmalloc (expected_len);
|
||||
{
|
||||
buffer = jnlib_malloc (expected_len);
|
||||
if (!buffer)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
buffer = buffer_space;
|
||||
|
||||
|
@ -267,6 +267,9 @@ set_file_fd (const char *name, int fd)
|
||||
|
||||
/* Setup a new stream. */
|
||||
#ifdef USE_FUNWRITER
|
||||
/* The xmalloc below is justified because we can expect that this
|
||||
function is called only during initialization and there is no
|
||||
easy way out of this error condition. */
|
||||
cookie = jnlib_xmalloc (sizeof *cookie + (name? strlen (name):0));
|
||||
strcpy (cookie->name, name? name:"");
|
||||
cookie->quiet = 0;
|
||||
|
@ -252,9 +252,9 @@ length_sans_trailing_ws (const unsigned char *line, size_t len)
|
||||
|
||||
|
||||
|
||||
/***************
|
||||
* Extract from a given path the filename component.
|
||||
*
|
||||
/*
|
||||
* Extract from a given path the filename component. This function
|
||||
* terminates the process on memory shortage.
|
||||
*/
|
||||
char *
|
||||
make_basename(const char *filepath, const char *inputpath)
|
||||
@ -281,11 +281,10 @@ make_basename(const char *filepath, const char *inputpath)
|
||||
|
||||
|
||||
|
||||
/***************
|
||||
* Extract from a given filename the path prepended to it.
|
||||
* If their isn't a path prepended to the filename, a dot
|
||||
* is returned ('.').
|
||||
*
|
||||
/*
|
||||
* Extract from a given filename the path prepended to it. If there
|
||||
* isn't a path prepended to the filename, a dot is returned ('.').
|
||||
* This function terminates the process on memory shortage.
|
||||
*/
|
||||
char *
|
||||
make_dirname(const char *filepath)
|
||||
@ -346,7 +345,8 @@ make_dirname(const char *filepath)
|
||||
|
||||
|
||||
/* Construct a filename from the NULL terminated list of parts. Tilde
|
||||
expansion is done here. This function will never fail. */
|
||||
expansion is done here. This function terminates the process on
|
||||
memory shortage. */
|
||||
char *
|
||||
make_filename (const char *first_part, ... )
|
||||
{
|
||||
@ -361,7 +361,7 @@ char *
|
||||
make_filename_try (const char *first_part, ... )
|
||||
{
|
||||
MAKE_FILENAME_PART1
|
||||
name = jnlib_xmalloc (n);
|
||||
name = jnlib_malloc (n);
|
||||
if (!name)
|
||||
return NULL;
|
||||
MAKE_FILENAME_PART2
|
||||
@ -550,8 +550,9 @@ print_sanitized_utf8_string (FILE *fp, const char *string, int delim)
|
||||
delim) : 0;
|
||||
}
|
||||
|
||||
/* Create a string from the buffer P_ARG of length N which is suitable for
|
||||
printing. Caller must release the created string using xfree. */
|
||||
/* Create a string from the buffer P_ARG of length N which is suitable
|
||||
for printing. Caller must release the created string using xfree.
|
||||
This function terminates the process on memory shortage. */
|
||||
char *
|
||||
sanitize_buffer (const void *p_arg, size_t n, int delim)
|
||||
{
|
||||
@ -940,7 +941,8 @@ do_percent_escape (const char *str, const char *extra, int die)
|
||||
}
|
||||
|
||||
/* Percent-escape the string STR by replacing colons with '%3a'. If
|
||||
EXTRA is not NULL all characters in EXTRA are also escaped. */
|
||||
EXTRA is not NULL all characters in EXTRA are also escaped. This
|
||||
function terminates the process on memory shortage. */
|
||||
char *
|
||||
percent_escape (const char *str, const char *extra)
|
||||
{
|
||||
|
@ -41,6 +41,8 @@ free_strlist( strlist_t sl )
|
||||
}
|
||||
|
||||
|
||||
/* Add STRING to the LIST at the front. This function terminates the
|
||||
process on memory shortage. */
|
||||
strlist_t
|
||||
add_to_strlist( strlist_t *list, const char *string )
|
||||
{
|
||||
@ -55,8 +57,9 @@ add_to_strlist( strlist_t *list, const char *string )
|
||||
}
|
||||
|
||||
|
||||
/* Same as add_to_strlist() but if is_utf8 is *not* set, a conversion
|
||||
to UTF-8 is done. */
|
||||
/* Same as add_to_strlist() but if IS_UTF8 is *not* set, a conversion
|
||||
to UTF-8 is done. This function terminates the process on memory
|
||||
shortage. */
|
||||
#ifdef JNLIB_NEED_UTF8CONV
|
||||
strlist_t
|
||||
add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
|
||||
@ -75,6 +78,9 @@ add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
|
||||
}
|
||||
#endif /* JNLIB_NEED_UTF8CONV*/
|
||||
|
||||
|
||||
/* Add STRING to the LIST at the end. This function terminates the
|
||||
process on memory shortage. */
|
||||
strlist_t
|
||||
append_to_strlist( strlist_t *list, const char *string )
|
||||
{
|
||||
@ -114,7 +120,8 @@ append_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
|
||||
#endif /* JNLIB_NEED_UTF8CONV */
|
||||
|
||||
|
||||
/* Return a copy of LIST. */
|
||||
/* Return a copy of LIST. This function terminates the process on
|
||||
memory shortage.*/
|
||||
strlist_t
|
||||
strlist_copy (strlist_t list)
|
||||
{
|
||||
@ -155,6 +162,9 @@ strlist_last( strlist_t node )
|
||||
}
|
||||
|
||||
|
||||
/* Remove the first item from LIST and return its content in an
|
||||
allocated buffer. This function terminates the process on memory
|
||||
shortage. */
|
||||
char *
|
||||
strlist_pop (strlist_t *list)
|
||||
{
|
||||
|
@ -314,7 +314,8 @@ is_native_utf8 (void)
|
||||
|
||||
|
||||
/* Convert string, which is in native encoding to UTF8 and return a
|
||||
new allocated UTF-8 string. */
|
||||
new allocated UTF-8 string. This function terminates the process
|
||||
on memory shortage. */
|
||||
char *
|
||||
native_to_utf8 (const char *orig_string)
|
||||
{
|
||||
@ -682,7 +683,8 @@ do_utf8_to_native (const char *string, size_t length, int delim,
|
||||
illegal encodings by some "\xnn" and quote all control
|
||||
characters. A character with value DELIM will always be quoted, it
|
||||
must be a vanilla ASCII character. A DELIM value of -1 is special:
|
||||
it disables all quoting of control characters. */
|
||||
it disables all quoting of control characters. This function
|
||||
terminates the process on memory shortage. */
|
||||
char *
|
||||
utf8_to_native (const char *string, size_t length, int delim)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user