Move p_sha1_hash() to stanza.c

Move `p_sha1_hash()` from `common.c` to	`xmpp/stanza.c` as it is only
used in this file and now depends on libstrophe so xmpp is a better
namespace folder.
Renaming it as `_stanza_create_sha1_hash()`. And making static since
only used here.

The function cannot be tested in the unit tests anymore.
Once functional tests are working again we should write a test for the
sha1 functionality.
This commit is contained in:
Michael Vetter
2018-09-06 20:32:08 +02:00
parent 9e021d5c8f
commit 82f8083b85
6 changed files with 18 additions and 90 deletions

View File

@@ -55,7 +55,6 @@
#include "log.h"
#include "common.h"
#include <strophe.h>
struct curl_data_t
{
@@ -330,21 +329,6 @@ release_is_new(char *found_version)
}
}
char*
p_sha1_hash(char *str)
{
unsigned char *digest = (unsigned char*)malloc(XMPP_SHA1_DIGEST_SIZE);
assert(digest != NULL);
xmpp_sha1_digest((unsigned char*)str, strlen(str), digest);
char *b64 = g_base64_encode(digest, XMPP_SHA1_DIGEST_SIZE);
assert(b64 != NULL);
free(digest);
return b64;
}
static size_t
_data_callback(void *ptr, size_t size, size_t nmemb, void *data)
{