|
@@ -3,11 +3,11 @@
|
|
|
|
|
|
#define NT 100000
|
|
#define NT 100000
|
|
|
|
|
|
-static LSUP_Triple *
|
|
|
|
-generate_triples(size_t nt)
|
|
|
|
|
|
+static LSUP_Triple **
|
|
|
|
+generate_triples (size_t nt)
|
|
{
|
|
{
|
|
- LSUP_Triple *trp;
|
|
|
|
- trp = malloc((nt + 1) * sizeof(LSUP_Triple));
|
|
|
|
|
|
+ LSUP_Triple **trp;
|
|
|
|
+ trp = malloc((nt + 1) * sizeof(*trp));
|
|
if (!trp) exit (-1);
|
|
if (!trp) exit (-1);
|
|
|
|
|
|
for (size_t i = 0; i < nt; i++) {
|
|
for (size_t i = 0; i < nt; i++) {
|
|
@@ -16,11 +16,11 @@ generate_triples(size_t nt)
|
|
sprintf(sstr, "urn:s:%lu", i % (nt / 100));
|
|
sprintf(sstr, "urn:s:%lu", i % (nt / 100));
|
|
sprintf(pstr, "urn:p:%lu", i % (nt / 1000));
|
|
sprintf(pstr, "urn:p:%lu", i % (nt / 1000));
|
|
sprintf(ostr, "urn:o:%lu", i);
|
|
sprintf(ostr, "urn:o:%lu", i);
|
|
- LSUP_triple_init(
|
|
|
|
- trp + i, LSUP_iriref_new (sstr, NULL),
|
|
|
|
- LSUP_iriref_new (pstr, NULL), LSUP_iriref_new (ostr, NULL));
|
|
|
|
|
|
+ trp[i] = LSUP_triple_new(
|
|
|
|
+ LSUP_iriref_new (sstr, NULL),
|
|
|
|
+ LSUP_iriref_new (pstr, NULL),
|
|
|
|
+ LSUP_iriref_new (ostr, NULL));
|
|
}
|
|
}
|
|
- LSUP_triple_init (trp + nt, NULL, NULL, NULL);
|
|
|
|
log_info ("Triples generated.");
|
|
log_info ("Triples generated.");
|
|
|
|
|
|
return trp;
|
|
return trp;
|
|
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
|
|
log_info ("Generating %lu triples.", nt);
|
|
log_info ("Generating %lu triples.", nt);
|
|
start = clock();
|
|
start = clock();
|
|
|
|
|
|
- LSUP_Triple *trp = generate_triples(nt);
|
|
|
|
|
|
+ LSUP_Triple **trp = generate_triples(nt);
|
|
tc1 = clock();
|
|
tc1 = clock();
|
|
wallclock = (double) (tc1 - start) / CLOCKS_PER_SEC;
|
|
wallclock = (double) (tc1 - start) / CLOCKS_PER_SEC;
|
|
log_info ("Time elapsed: %lf s", wallclock);
|
|
log_info ("Time elapsed: %lf s", wallclock);
|
|
@@ -63,11 +63,8 @@ int main(int argc, char *argv[])
|
|
if (rc != LSUP_OK) log_warn ("Graph loading interrupted: %d.", rc);
|
|
if (rc != LSUP_OK) log_warn ("Graph loading interrupted: %d.", rc);
|
|
else log_info ("Graph populated with %lu triples.", ct);
|
|
else log_info ("Graph populated with %lu triples.", ct);
|
|
|
|
|
|
- for (size_t i = 0; i < nt; i++) {
|
|
|
|
- LSUP_term_free (trp[i].s);
|
|
|
|
- LSUP_term_free (trp[i].p);
|
|
|
|
- LSUP_term_free (trp[i].o);
|
|
|
|
- }
|
|
|
|
|
|
+ for (size_t i = 0; i < nt; i++)
|
|
|
|
+ LSUP_triple_free (trp[i]);
|
|
free (trp);
|
|
free (trp);
|
|
|
|
|
|
tc2 = clock();
|
|
tc2 = clock();
|