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>
|
2009-06-04 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* mischelp.h: Include SUN_LEN etc also for W32.
|
* mischelp.h: Include SUN_LEN etc also for W32.
|
||||||
|
@ -598,7 +598,11 @@ read_lockfile (DOTLOCK h, int *same_node )
|
|||||||
*same_node = 0;
|
*same_node = 0;
|
||||||
expected_len = 10 + 1 + h->nodename_len + 1;
|
expected_len = 10 + 1 + h->nodename_len + 1;
|
||||||
if ( expected_len >= sizeof buffer_space)
|
if ( expected_len >= sizeof buffer_space)
|
||||||
buffer = jnlib_xmalloc (expected_len);
|
{
|
||||||
|
buffer = jnlib_malloc (expected_len);
|
||||||
|
if (!buffer)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
buffer = buffer_space;
|
buffer = buffer_space;
|
||||||
|
|
||||||
|
@ -267,6 +267,9 @@ set_file_fd (const char *name, int fd)
|
|||||||
|
|
||||||
/* Setup a new stream. */
|
/* Setup a new stream. */
|
||||||
#ifdef USE_FUNWRITER
|
#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));
|
cookie = jnlib_xmalloc (sizeof *cookie + (name? strlen (name):0));
|
||||||
strcpy (cookie->name, name? name:"");
|
strcpy (cookie->name, name? name:"");
|
||||||
cookie->quiet = 0;
|
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 *
|
char *
|
||||||
make_basename(const char *filepath, const char *inputpath)
|
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.
|
* Extract from a given filename the path prepended to it. If there
|
||||||
* If their isn't a path prepended to the filename, a dot
|
* isn't a path prepended to the filename, a dot is returned ('.').
|
||||||
* is returned ('.').
|
* This function terminates the process on memory shortage.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
make_dirname(const char *filepath)
|
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
|
/* 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 *
|
char *
|
||||||
make_filename (const char *first_part, ... )
|
make_filename (const char *first_part, ... )
|
||||||
{
|
{
|
||||||
@ -361,7 +361,7 @@ char *
|
|||||||
make_filename_try (const char *first_part, ... )
|
make_filename_try (const char *first_part, ... )
|
||||||
{
|
{
|
||||||
MAKE_FILENAME_PART1
|
MAKE_FILENAME_PART1
|
||||||
name = jnlib_xmalloc (n);
|
name = jnlib_malloc (n);
|
||||||
if (!name)
|
if (!name)
|
||||||
return NULL;
|
return NULL;
|
||||||
MAKE_FILENAME_PART2
|
MAKE_FILENAME_PART2
|
||||||
@ -550,8 +550,9 @@ print_sanitized_utf8_string (FILE *fp, const char *string, int delim)
|
|||||||
delim) : 0;
|
delim) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a string from the buffer P_ARG of length N which is suitable for
|
/* Create a string from the buffer P_ARG of length N which is suitable
|
||||||
printing. Caller must release the created string using xfree. */
|
for printing. Caller must release the created string using xfree.
|
||||||
|
This function terminates the process on memory shortage. */
|
||||||
char *
|
char *
|
||||||
sanitize_buffer (const void *p_arg, size_t n, int delim)
|
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
|
/* 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 *
|
char *
|
||||||
percent_escape (const char *str, const char *extra)
|
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
|
strlist_t
|
||||||
add_to_strlist( strlist_t *list, const char *string )
|
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
|
/* Same as add_to_strlist() but if IS_UTF8 is *not* set, a conversion
|
||||||
to UTF-8 is done. */
|
to UTF-8 is done. This function terminates the process on memory
|
||||||
|
shortage. */
|
||||||
#ifdef JNLIB_NEED_UTF8CONV
|
#ifdef JNLIB_NEED_UTF8CONV
|
||||||
strlist_t
|
strlist_t
|
||||||
add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
|
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*/
|
#endif /* JNLIB_NEED_UTF8CONV*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Add STRING to the LIST at the end. This function terminates the
|
||||||
|
process on memory shortage. */
|
||||||
strlist_t
|
strlist_t
|
||||||
append_to_strlist( strlist_t *list, const char *string )
|
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 */
|
#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_t
|
||||||
strlist_copy (strlist_t list)
|
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 *
|
char *
|
||||||
strlist_pop (strlist_t *list)
|
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
|
/* 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 *
|
char *
|
||||||
native_to_utf8 (const char *orig_string)
|
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
|
illegal encodings by some "\xnn" and quote all control
|
||||||
characters. A character with value DELIM will always be quoted, it
|
characters. A character with value DELIM will always be quoted, it
|
||||||
must be a vanilla ASCII character. A DELIM value of -1 is special:
|
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 *
|
char *
|
||||||
utf8_to_native (const char *string, size_t length, int delim)
|
utf8_to_native (const char *string, size_t length, int delim)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user