]> rtime.felk.cvut.cz Git - frescor/frsh.git/blobdiff - fres/contract/fres_contract.h
Suppress warning in fres_contract_id_to_string() on 64 bit system
[frescor/frsh.git] / fres / contract / fres_contract.h
index 3ed4cacf726e0b1a667c2960290a960adfd1dd70..8710cebf529551f6ed0e845fb6346df82ad8ac38 100644 (file)
 #include <fres_contract_type.h>
 #include <fres_contract_idl.h>
 #include <forb/server_id.h>
-
+#include <stdio.h>
+#ifdef __cplusplus__
+#  define __STDC_FORMAT_MACROS
+#endif
+#include <inttypes.h>
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -85,23 +89,26 @@ static inline int fres_contract_id_cmp(const fres_contract_id_t *a,
 
 static inline bool fres_contract_id_is_empty(const fres_contract_id_t *id)
 {
-       bool empty = true;
-       unsigned i;
-
-       for (i=0; i<sizeof(id->byte); i++) {
-               if (id->byte[i] != 0) {
-                       empty = false;
-                       break;
-               }
-       }
-       return empty;
+/*     bool empty = true; */
+/*     unsigned i; */
+
+/*     for (i=0; i<sizeof(id->byte); i++) { */
+/*             if (id->byte[i] != 0) { */
+/*                     empty = false; */
+/*                     break; */
+/*             } */
+/*     } */
+/*     return empty; */
+       return *id == 0;
 }
 
 static inline char *fres_contract_id_to_string(char *dest,
                                               const fres_contract_id_t *id,
                                               size_t n)
 {
-       return forb_server_id_to_string(dest, (forb_server_id*)id, n);
+       snprintf(dest, n, "%"PRIx64, *id);
+/*     return forb_server_id_to_string(dest, (forb_server_id*)id, n); */
+       return dest;
 }
 
 struct fres_contract *fres_contract_new(void);
@@ -179,6 +186,12 @@ fres_contract_to_string2(char *dest, size_t size, const struct fres_contract *c,
 bool
 fres_contract_get_deadline(const frsh_contract_t *contract,
                           frsh_rel_time_t       *deadline);
+bool
+fres_contract_get_budget(const frsh_contract_t *contract,
+                        frsh_rel_time_t       *budget);
+bool
+fres_contract_get_period(const frsh_contract_t *contract,
+                        frsh_rel_time_t       *period);
 frsh_contract_type_t
 fres_contract_get_type(const frsh_contract_t *contract);