#endif
#include <errno.h>
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-typedef int32_t prof_int32;
-
/* Create a vtable profile, possibly with a library handle. The new profile
* takes ownership of the handle refcount on success. */
static errcode_t
cleanup:
free(modpath);
free(residual);
- krb5int_clear_error(&einfo);
+ k5_clear_error(&einfo);
if (err) {
if (have_cbdata && vtable.cleanup)
vtable.cleanup(cbdata);
/* Increment the refcount on the library handle if there is one. */
if (profile->lib_handle) {
- err = k5_mutex_lock(&profile->lib_handle->lock);
- if (err) {
- /* Don't decrement the refcount we failed to increment. */
- new_profile->lib_handle = NULL;
- profile_abandon(new_profile);
- return err;
- }
+ k5_mutex_lock(&profile->lib_handle->lock);
profile->lib_handle->refcount++;
k5_mutex_unlock(&profile->lib_handle->lock);
}
profile_abandon(profile_t profile)
{
prf_file_t p, next;
- errcode_t err;
if (!profile || profile->magic != PROF_MAGIC_PROFILE)
return;
profile->vt->cleanup(profile->cbdata);
if (profile->lib_handle) {
/* Decrement the refcount on the handle and maybe free it. */
- err = k5_mutex_lock(&profile->lib_handle->lock);
- if (!err && --profile->lib_handle->refcount == 0) {
+ k5_mutex_lock(&profile->lib_handle->lock);
+ if (--profile->lib_handle->refcount == 0) {
krb5int_close_plugin(profile->lib_handle->plugin_handle);
k5_mutex_unlock(&profile->lib_handle->lock);
k5_mutex_destroy(&profile->lib_handle->lock);
free(profile->lib_handle);
- } else if (!err)
+ } else
k5_mutex_unlock(&profile->lib_handle->lock);
}
free(profile->vt);
size_t required;
prf_file_t pfp;
- required = 3*sizeof(prof_int32);
+ required = 3*sizeof(int32_t);
for (pfp = profile->first_file; pfp; pfp = pfp->next) {
- required += sizeof(prof_int32);
+ required += sizeof(int32_t);
required += strlen(pfp->data->filespec);
}
*sizep += required;
return 0;
}
-static void pack_int32(prof_int32 oval, unsigned char **bufpp, size_t *remainp)
+static void pack_int32(int32_t oval, unsigned char **bufpp, size_t *remainp)
{
store_32_be(oval, *bufpp);
- *bufpp += sizeof(prof_int32);
- *remainp -= sizeof(prof_int32);
+ *bufpp += sizeof(int32_t);
+ *remainp -= sizeof(int32_t);
}
errcode_t profile_ser_externalize(const char *unused, profile_t profile,
unsigned char *bp;
size_t remain;
prf_file_t pfp;
- prof_int32 fcount, slen;
+ int32_t fcount, slen;
required = 0;
bp = *bufpp;
pack_int32(PROF_MAGIC_PROFILE, &bp, &remain);
pack_int32(fcount, &bp, &remain);
for (pfp = profile->first_file; pfp; pfp = pfp->next) {
- slen = (prof_int32) strlen(pfp->data->filespec);
+ slen = (int32_t) strlen(pfp->data->filespec);
pack_int32(slen, &bp, &remain);
if (slen) {
memcpy(bp, pfp->data->filespec, (size_t) slen);
return(retval);
}
-static int unpack_int32(prof_int32 *intp, unsigned char **bufpp,
+static int unpack_int32(int32_t *intp, unsigned char **bufpp,
size_t *remainp)
{
- if (*remainp >= sizeof(prof_int32)) {
+ if (*remainp >= sizeof(int32_t)) {
*intp = load_32_be(*bufpp);
- *bufpp += sizeof(prof_int32);
- *remainp -= sizeof(prof_int32);
+ *bufpp += sizeof(int32_t);
+ *remainp -= sizeof(int32_t);
return 0;
}
else
unsigned char *bp;
size_t remain;
int i;
- prof_int32 fcount, tmp;
+ int32_t fcount, tmp;
profile_filespec_t *flist = 0;
bp = *bufpp;