summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sucha <anty.sk+git@gmail.com>2018-05-18 10:43:26 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2018-05-19 11:55:59 +0200
commit8175ea952059970bd9a5da0c6e3f2826b8d94002 (patch)
tree8a77328213fe1a7b77203ad93f4b2e491e39a0e8 /src
parent663f6cb738a50d165221f5f09bccc9d5d44d6d1b (diff)
downloadgnutls-8175ea952059970bd9a5da0c6e3f2826b8d94002.tar.gz
certtool: remove extra function
I did not notice strip_nl previously. Signed-off-by: Martin Sucha <anty.sk+git@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/certtool-cfg.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/certtool-cfg.c b/src/certtool-cfg.c
index 577bccf8b7..1a14b2f331 100644
--- a/src/certtool-cfg.c
+++ b/src/certtool-cfg.c
@@ -1546,25 +1546,6 @@ int default_crl_number(unsigned char* serial, size_t *size)
}
/**
- * strip_trailing_newlines:
- * @str: zero-terminated string that will be modified in-place, must not be NULL
- *
- * This function will remove trailing CR or LF characters.
- **/
-static void strip_trailing_newlines(char *str)
-{
- char *end;
-
- end = str;
- while (*end != '\0') end++;
- end--;
- while (end >= str && (*end == '\r' || *end == '\n')) {
- *end = '\0';
- end--;
- }
-}
-
-/**
* read_serial_value:
* @serial: pointer to buffer with serial number
* @size: pointer to actual size of data in buffer
@@ -1583,6 +1564,7 @@ void read_serial_value(unsigned char *serial, size_t *size, size_t max_size,
{
static char input[MAX_INPUT_SIZE];
int ret;
+ size_t input_len;
gnutls_datum_t decoded;
gnutls_datum_t serial_datum;
gnutls_datum_t encoded_default;
@@ -1604,9 +1586,9 @@ void read_serial_value(unsigned char *serial, size_t *size, size_t max_size,
if (fgets(input, sizeof(input), stdin) == NULL)
return;
- strip_trailing_newlines(input);
+ input_len = strip_nl(input, strlen(input));
- if (strlen(input) == 0)
+ if (input_len == 0)
return;
ret = serial_decode(input, &decoded);