use uint64_t for hdb_handle_t type and also specify some formatting

strings for printing handles out of the handle database.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2126 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2009-04-23 10:03:01 +00:00
parent 1beb0c1fbd
commit 65f8490350
3 changed files with 15 additions and 7 deletions

View File

@ -41,8 +41,16 @@
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <stdint.h>
#include <inttypes.h>
typedef unsigned long long hdb_handle_t;
typedef uint64_t hdb_handle_t;
/*
* Formatting for string printing on 32/64 bit systems
*/
#define HDB_D_FORMAT "%"PRIu64
#define HDB_X_FORMAT "%"PRIx64
enum HDB_HANDLE_STATE {
HDB_HANDLE_STATE_EMPTY,

View File

@ -71,7 +71,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
/* Show the keys */
res = confdb_key_iter_start(handle, parent_object_handle);
if (res != CS_OK) {
printf( "error resetting key iterator for object %llu: %d\n", parent_object_handle, res);
printf( "error resetting key iterator for object "HDB_X_FORMAT": %d\n", parent_object_handle, res);
return;
}
@ -86,7 +86,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
/* Show sub-objects */
res = confdb_object_iter_start(handle, parent_object_handle);
if (res != CS_OK) {
printf( "error resetting object iterator for object %llu: %d\n", parent_object_handle, res);
printf( "error resetting object iterator for object "HDB_X_FORMAT": %d\n", parent_object_handle, res);
return;
}
@ -95,14 +95,14 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
res = confdb_object_parent_get(handle, object_handle, &parent);
if (res != CS_OK) {
printf( "error getting parent for object %lld: %d\n", object_handle, res);
printf( "error getting parent for object "HDB_X_FORMAT": %d\n", object_handle, res);
return;
}
for (i=0; i<depth; i++) printf(" ");
object_name[object_name_len] = '\0';
printf("OBJECT: %s (%llu, parent: %llu)\n", object_name, object_handle, parent);
printf("OBJECT: %s ("HDB_X_FORMAT", parent: "HDB_X_FORMAT")\n", object_name, object_handle, parent);
/* Down we go ... */
print_config_tree(handle, object_handle, depth+1);

View File

@ -114,7 +114,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
/* Show the keys */
res = confdb_key_iter_start(handle, parent_object_handle);
if (res != CS_OK) {
fprintf(stderr, "error resetting key iterator for object %llu: %d\n", parent_object_handle, res);
fprintf(stderr, "error resetting key iterator for object "HDB_X_FORMAT" %d\n", parent_object_handle, res);
exit(EXIT_FAILURE);
}
children_printed = 0;
@ -138,7 +138,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
/* Show sub-objects */
res = confdb_object_iter_start(handle, parent_object_handle);
if (res != CS_OK) {
fprintf(stderr, "error resetting object iterator for object %llu: %d\n", parent_object_handle, res);
fprintf(stderr, "error resetting object iterator for object "HDB_X_FORMAT" %d\n", parent_object_handle, res);
exit(EXIT_FAILURE);
}