Browse Source

Remove pointer checks in private functions

In the static functions of the secretcfg module, do not check
the pointers passed as arguments. These functions are only called
from within that module, so we can be sure they are never called
with an invalid pointer.
master
Damien Goutte-Gattat 5 years ago
parent
commit
c60fec5563
  1. 12
      src/secretcfg.c

12
src/secretcfg.c

@ -47,9 +47,6 @@ get_line(FILE *f, char *buffer, size_t len)
int c;
size_t n = 0;
if ( ! f || ! buffer )
return GFSEC_ERR_INVALID_CALL;
while ( (c = fgetc(f)) != '\n' ) {
if ( c == EOF )
return GFSEC_ERR_SYSTEM_ERROR;
@ -82,9 +79,6 @@ parse_authority(const char **uri, char **authority)
{
char *slash;
if ( ! uri || ! authority )
return GFSEC_ERR_INVALID_CALL;
if ( (slash = strchr(*uri, '/')) ) {
if ( ! (*authority = strndup(*uri, slash - *uri)) )
return GFSEC_ERR_SYSTEM_ERROR;
@ -114,9 +108,6 @@ parse_path(const char **uri, char **path)
{
char *qm;
if ( ! uri )
return GFSEC_ERR_INVALID_CALL;
qm = strchrnul(*uri, '?');
if ( ! (*path = strndup(*uri, qm - *uri)) )
return GFSEC_ERR_SYSTEM_ERROR;
@ -261,9 +252,6 @@ parse_uri(const char *uri, gfsec_secret_t *secret)
const char *p = uri;
int rc = 0;
if ( ! uri || ! secret )
return GFSEC_ERR_INVALID_CALL;
if ( ! (share = gfsec_share_new()) )
return GFSEC_ERR_SYSTEM_ERROR;

Loading…
Cancel
Save