You are viewing a plain text version of this content. The canonical link for it is here.
Posted to triplesoup-commits@incubator.apache.org by le...@apache.org on 2007/04/13 16:09:21 UTC
svn commit: r528542 - in /incubator/triplesoup/code/trunk: ./ libraries/b/
Author: leosimons
Date: Fri Apr 13 09:09:20 2007
New Revision: 528542
URL: http://svn.apache.org/viewvc?view=rev&rev=528542
Log:
Merge relevant parts of revisions r528519 and r528537 (updates to the libb
contribution) into code/trunk.
Added:
incubator/triplesoup/code/trunk/libraries/b/bel.c
incubator/triplesoup/code/trunk/libraries/b/bjournaling.c
Modified:
incubator/triplesoup/code/trunk/NOTICE.txt
incubator/triplesoup/code/trunk/libraries/b/Makefile.in
incubator/triplesoup/code/trunk/libraries/b/badd.c
incubator/triplesoup/code/trunk/libraries/b/bcache.c
incubator/triplesoup/code/trunk/libraries/b/bcount.c
incubator/triplesoup/code/trunk/libraries/b/bdestroy.c
incubator/triplesoup/code/trunk/libraries/b/berror.c
incubator/triplesoup/code/trunk/libraries/b/bget.c
incubator/triplesoup/code/trunk/libraries/b/bhash.c
incubator/triplesoup/code/trunk/libraries/b/bio.c
incubator/triplesoup/code/trunk/libraries/b/biterator.c
incubator/triplesoup/code/trunk/libraries/b/bmd5.c
incubator/triplesoup/code/trunk/libraries/b/bnew.c
incubator/triplesoup/code/trunk/libraries/b/bremove.c
incubator/triplesoup/code/trunk/libraries/b/bstring.c
incubator/triplesoup/code/trunk/libraries/b/bsync.c
incubator/triplesoup/code/trunk/libraries/b/btcache.c
incubator/triplesoup/code/trunk/libraries/b/btempty.c
incubator/triplesoup/code/trunk/libraries/b/btimer.c
incubator/triplesoup/code/trunk/libraries/b/btriple.c
Modified: incubator/triplesoup/code/trunk/NOTICE.txt
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/NOTICE.txt?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/NOTICE.txt (original)
+++ incubator/triplesoup/code/trunk/NOTICE.txt Fri Apr 13 09:09:20 2007
@@ -9,3 +9,15 @@
This product includes software developed by The Apache Software
Foundation (http://www.apache.org/).
+
+Portions of TripleSoup were originally developed by Joost Technologies
+B.V. (formerly Satis Superque Merce B.V.) and are licensed to the Apache
+Software Fondation under the terms of a Software Grant and a Corporate
+Contribution License Agreement.
+
+The following copyright notice(s) were affixed to portions of the code
+with which this file is now or was at one time distributed
+and are placed here unaltered.
+
+ (c) 2006 Satis Superque Merce B.V. All rights reserved.
+ (c) 2007 Satis Superque Merce B.V. All rights reserved.
Modified: incubator/triplesoup/code/trunk/libraries/b/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/Makefile.in?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/Makefile.in (original)
+++ incubator/triplesoup/code/trunk/libraries/b/Makefile.in Fri Apr 13 09:09:20 2007
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
topsrcdir = @top_srcdir@
include $(topsrcdir)/build/rules.mk
@@ -13,11 +28,13 @@
bcache.c \
bcount.c \
bdestroy.c \
+ bel.c \
berror.c \
bget.c \
bhash.c \
bio.c \
biterator.c \
+ bjournaling.c \
bmd5.c \
bnew.c \
bremove.c \
Modified: incubator/triplesoup/code/trunk/libraries/b/badd.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/badd.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/badd.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/badd.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -45,8 +52,6 @@
b_cache_destroy (exist);
return B_OK;
}
-
- b_cache_destroy (exist);
if ((error = b_get_type_internal (data, type, &io)) != B_OK)
return error;
Modified: incubator/triplesoup/code/trunk/libraries/b/bcache.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bcache.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bcache.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bcache.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
Modified: incubator/triplesoup/code/trunk/libraries/b/bcount.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bcount.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bcount.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bcount.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
Modified: incubator/triplesoup/code/trunk/libraries/b/bdestroy.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bdestroy.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bdestroy.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bdestroy.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -59,6 +66,15 @@
if (data->triples_io)
b_io_destroy (data->triples_io);
+
+ if (data->journaling_io)
+ b_io_destroy (data->journaling_io);
+
+ if (data->journaling_file)
+ {
+ remove ((char *) data->journaling_file);
+ free (data->journaling_file);
+ }
/* Free memory: */
free (data);
Added: incubator/triplesoup/code/trunk/libraries/b/bel.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bel.c?view=auto&rev=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bel.c (added)
+++ incubator/triplesoup/code/trunk/libraries/b/bel.c Fri Apr 13 09:09:20 2007
@@ -0,0 +1,66 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <b.h>
+
+b_error_t
+b_el_new (b_tcache_t * cache, b_el_t ** list)
+{
+ b_el_t *new;
+
+ if (!(new = calloc (1, sizeof (b_el_t))))
+ return B_ERROR_MEMORY;
+
+ new->cache = cache;
+ new->next = *list;
+ *list = new;
+
+ return B_OK;
+}
+
+void
+b_el_free (b_el_t ** list)
+{
+ b_el_t *tmp;
+
+ while (*list)
+ {
+ tmp = *list;
+ *list = tmp->next;
+
+ if (tmp->cache)
+ b_tcache_destroy_single (NULL, NULL, tmp->cache);
+
+ free (tmp);
+ }
+}
+
+b_tcache_t *
+b_el_first (b_el_t ** list)
+{
+ b_el_t *first;
+ b_tcache_t *cache;
+
+ first = *list;
+ cache = first->cache;
+
+ *list = first->next;
+ free (first);
+
+ return cache;
+}
+
+/* EOF */
Modified: incubator/triplesoup/code/trunk/libraries/b/berror.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/berror.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/berror.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/berror.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
Modified: incubator/triplesoup/code/trunk/libraries/b/bget.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bget.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bget.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bget.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -130,7 +137,10 @@
return B_ERROR_MEMORY;
if (map.len && b_io_read (io, iwhat, map.len) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ free (iwhat);
+ return B_ERROR_INTERNAL;
+ }
iwhat[map.len] = 0;
}
@@ -183,7 +193,10 @@
return B_ERROR_MEMORY;
if (map.len && b_io_read (io, iwhat, map.len) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ free (iwhat);
+ return B_ERROR_INTERNAL;
+ }
iwhat[map.len] = 0;
@@ -274,7 +287,7 @@
b_tmap_t tmap;
b_tmap_item_t tmap_item;
- int i, j;
+ int i, j, elements;
char tmap_results[B_TMAP_NUMB];
B_LOG3 ("b_get_triple_cache: %p %p %p", data, triple, exist);
@@ -382,7 +395,7 @@
/* Check in the file: */
while (1)
{
- if (b_io_read (data->triples_io, &tmap, sizeof (tmap)) <= 0)
+ if (b_io_read (data->triples_io, &tmap, sizeof (b_tmap_t)) <= 0)
{
b_tcache_destroy_single (NULL, NULL, cache);
return B_OK;
@@ -397,48 +410,48 @@
memset (&tmap_results, 0, sizeof (tmap_results));
/* Disactive no compatible results: */
- for (i = 0; i < B_TMAP_NUMB; i++)
+ for (i = elements = 0; i < B_TMAP_NUMB; i++)
{
if (!tmap.map[i])
tmap_results[i] = 1;
else
- {
- if (cache->subject_uri
- && B_TMAP_VALUE (tmap.subjects_uri[i]) ==
- B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.subjects_uri[i])] = 1;
-
- if (cache->subject_bnode
- && B_TMAP_VALUE (tmap.subjects_bnode[i]) ==
- B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.subjects_bnode[i])] = 1;
-
- if (cache->object_uri
- && B_TMAP_VALUE (tmap.objects_uri[i]) == B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.objects_uri[i])] = 1;
-
- if (cache->object_bnode
- && B_TMAP_VALUE (tmap.objects_bnode[i]) ==
- B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.objects_bnode[i])] = 1;
-
- if (cache->object_literal
- && B_TMAP_VALUE (tmap.objects_literal[i]) ==
- B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.objects_literal[i])] = 1;
-
- if (cache->context
- && B_TMAP_VALUE (tmap.contexts[i]) == B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.contexts[i])] = 1;
-
- if (cache->datatype
- && B_TMAP_VALUE (tmap.datatypes[i]) == B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.datatypes[i])] = 1;
-
- if (cache->lang
- && B_TMAP_VALUE (tmap.langs[i]) == B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.langs[i])] = 1;
- }
+ elements++;
+ }
+
+ /* Disactive no compatible results: */
+ for (i = 0; i < elements; i++)
+ {
+ if (cache->subject_uri
+ && B_TMAP_VALUE (tmap.subjects_uri[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.subjects_uri[i])] = 1;
+
+ if (cache->subject_bnode
+ && B_TMAP_VALUE (tmap.subjects_bnode[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.subjects_bnode[i])] = 1;
+
+ if (cache->object_uri
+ && B_TMAP_VALUE (tmap.objects_uri[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.objects_uri[i])] = 1;
+
+ if (cache->object_bnode
+ && B_TMAP_VALUE (tmap.objects_bnode[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.objects_bnode[i])] = 1;
+
+ if (cache->object_literal
+ && B_TMAP_VALUE (tmap.objects_literal[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.objects_literal[i])] = 1;
+
+ if (cache->context
+ && B_TMAP_VALUE (tmap.contexts[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.contexts[i])] = 1;
+
+ if (cache->datatype
+ && B_TMAP_VALUE (tmap.datatypes[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.datatypes[i])] = 1;
+
+ if (cache->lang
+ && B_TMAP_VALUE (tmap.langs[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.langs[i])] = 1;
}
#define B_GET_FILE( x , y , n ) \
Modified: incubator/triplesoup/code/trunk/libraries/b/bhash.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bhash.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bhash.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bhash.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
Modified: incubator/triplesoup/code/trunk/libraries/b/bio.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bio.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bio.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bio.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
Modified: incubator/triplesoup/code/trunk/libraries/b/biterator.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/biterator.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/biterator.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/biterator.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -424,10 +431,7 @@
/* Previous results? */
else if (iterator->results)
{
- b_el_t *list = iterator->results;
- cache = list->cache;
- iterator->results = list->next;
- free (list);
+ cache = b_el_first (&iterator->results);
error = B_OK;
}
@@ -565,7 +569,7 @@
else
{
int tmap_results[B_TMAP_NUMB];
- int i, j;
+ int i, j, elements;
if (iterator->results)
return B_ERROR_INTERNAL;
@@ -583,48 +587,48 @@
memset (&tmap_results, 0, sizeof (tmap_results));
/* Disactive no compatible results: */
- for (i = 0; i < B_TMAP_NUMB; i++)
+ for (i = elements = 0; i < B_TMAP_NUMB; i++)
{
if (!tmap.map[i])
tmap_results[i] = 1;
else
- {
- if (iterator->compare->subject_uri_exists
- && B_TMAP_VALUE (tmap.subjects_uri[i]) ==
- B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.subjects_uri[i])] = 1;
-
- if (iterator->compare->subject_bnode_exists
- && B_TMAP_VALUE (tmap.subjects_bnode[i]) ==
- B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.subjects_bnode[i])] = 1;
-
- if (iterator->compare->object_uri_exists
- && B_TMAP_VALUE (tmap.objects_uri[i]) == B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.objects_uri[i])] = 1;
-
- if (iterator->compare->object_bnode_exists
- && B_TMAP_VALUE (tmap.objects_bnode[i]) ==
- B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.objects_bnode[i])] = 1;
-
- if (iterator->compare->object_literal_exists
- && B_TMAP_VALUE (tmap.objects_literal[i]) ==
- B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.objects_literal[i])] = 1;
-
- if (iterator->compare->context_exists
- && B_TMAP_VALUE (tmap.contexts[i]) == B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.contexts[i])] = 1;
-
- if (iterator->compare->datatype_exists
- && B_TMAP_VALUE (tmap.datatypes[i]) == B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.datatypes[i])] = 1;
-
- if (iterator->compare->lang_exists
- && B_TMAP_VALUE (tmap.langs[i]) == B_TMAP_VALUE_EMPTY)
- tmap_results[B_TMAP_DATA (tmap.langs[i])] = 1;
- }
+ elements++;
+ }
+
+ /* Disactive no compatible results: */
+ for (i = 0; i < elements; i++)
+ {
+ if (iterator->compare->subject_uri_exists
+ && B_TMAP_VALUE (tmap.subjects_uri[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.subjects_uri[i])] = 1;
+
+ if (iterator->compare->subject_bnode_exists
+ && B_TMAP_VALUE (tmap.subjects_bnode[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.subjects_bnode[i])] = 1;
+
+ if (iterator->compare->object_uri_exists
+ && B_TMAP_VALUE (tmap.objects_uri[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.objects_uri[i])] = 1;
+
+ if (iterator->compare->object_bnode_exists
+ && B_TMAP_VALUE (tmap.objects_bnode[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.objects_bnode[i])] = 1;
+
+ if (iterator->compare->object_literal_exists
+ && B_TMAP_VALUE (tmap.objects_literal[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.objects_literal[i])] = 1;
+
+ if (iterator->compare->context_exists
+ && B_TMAP_VALUE (tmap.contexts[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.contexts[i])] = 1;
+
+ if (iterator->compare->datatype_exists
+ && B_TMAP_VALUE (tmap.datatypes[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.datatypes[i])] = 1;
+
+ if (iterator->compare->lang_exists
+ && B_TMAP_VALUE (tmap.langs[i]) == B_TMAP_VALUE_EMPTY)
+ tmap_results[B_TMAP_DATA (tmap.langs[i])] = 1;
}
#define B_GET_FILE( x , y , n , e ) \
@@ -638,14 +642,12 @@
sizeof(b_tmap_item_t) * n, SEEK_SET); \
if (b_io_read (iterator->data->triples_io, &x, \
sizeof (b_tmap_item_t)) <= 0) \
- { \
- return B_ERROR_INTERNAL; \
- } \
+ return B_ERROR_INTERNAL; \
\
switch (b_hash_compare (x.hash, iterator->compare->x)) \
{ \
case -1: \
- for (j=0; j<B_TMAP_NUMB; j++) \
+ for (j = 0; j < B_TMAP_NUMB; j++) \
{ \
if (B_TMAP_VALUE (tmap.y[j]) != B_TMAP_VALUE_EMPTY) \
{ \
@@ -657,7 +659,7 @@
break; \
\
case 1: \
- for (j=B_TMAP_NUMB-1; j>=0; j--) \
+ for (j = B_TMAP_NUMB-1; j >=0; j--) \
{ \
if (B_TMAP_VALUE (tmap.y[j]) != B_TMAP_VALUE_EMPTY) \
{ \
@@ -692,8 +694,14 @@
B_GET_FILE (datatype, datatypes, 7, datatype_exists);
B_GET_FILE (lang, langs, 8, lang_exists);
+ if (tmap_results[i])
+ continue;
+
if (!(c = (b_tcache_t *) calloc (1, sizeof (b_tcache_t))))
- return B_ERROR_MEMORY;
+ {
+ b_el_free (&iterator->results);
+ return B_ERROR_MEMORY;
+ }
b_io_seek (iterator->data->triples_io,
tmap_pointer + sizeof (b_tmap_t) + i * B_TRIPLE_SIZE,
@@ -704,6 +712,7 @@
sizeof (b_tmap_item_t)) <= 0) \
{ \
b_tcache_destroy_single (NULL, NULL, c); \
+ b_el_free (&iterator->results); \
return B_ERROR_INTERNAL; \
} \
\
@@ -714,12 +723,14 @@
!= B_OK) \
{ \
b_tcache_destroy_single (NULL, NULL, c); \
+ b_el_free (&iterator->results); \
return error; \
} \
\
if (!c->x) \
{ \
b_tcache_destroy_single (NULL, NULL, c); \
+ b_el_free (&iterator->results); \
return B_ERROR_INTERNAL; \
} \
}
@@ -734,8 +745,15 @@
B_TRIPLE_POINTER2 (datatype, B_TYPE_DATATYPE);
B_TRIPLE_POINTER2 (lang, B_TYPE_LITERAL);
- b_tcache_destroy_single (NULL, NULL, c);
+ c->tmap_index = i;
+ c->tmap_pointer = tmap_pointer;
+ if ((error = b_el_new (c, &iterator->results)) != B_OK)
+ {
+ b_tcache_destroy_single (NULL, NULL, c);
+ b_el_free (&iterator->results);
+ return error;
+ }
}
if (iterator->results)
Added: incubator/triplesoup/code/trunk/libraries/b/bjournaling.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bjournaling.c?view=auto&rev=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bjournaling.c (added)
+++ incubator/triplesoup/code/trunk/libraries/b/bjournaling.c Fri Apr 13 09:09:20 2007
@@ -0,0 +1,315 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <b.h>
+#include <stdarg.h>
+
+static char b_journaling_io (b_t * data, b_io_t * io);
+static b_error_t b_journaling_recover_cache_empty (b_t * data, b_io_t * io,
+ b_uint64 * done);
+static b_error_t b_journaling_recover_end_write (b_t * data, b_io_t * io,
+ b_uint64 * done);
+static b_error_t b_journaling_recover_write (b_t * data, b_io_t * io,
+ b_uint64 * done);
+
+/* Journaling procedure: */
+void
+b_journaling_new (b_t * data, b_io_t * io, b_journaling_type_t type, ...)
+{
+ va_list va;
+ b_uint64 pointer;
+ size_t size;
+ unsigned char *what;
+ char freed;
+ char cio;
+ b_string_t *str;
+
+ /* Witch filedescriptor? */
+ cio = b_journaling_io (data, io);
+
+ va_start (va, type);
+
+ /* Witch operation? */
+ switch (type)
+ {
+ case B_JOURNALING_CACHE_EMPTY:
+ /* No argument */
+
+ if (b_string_new (&str) != B_OK)
+ return;
+
+ b_string_add (str, (unsigned char *) &cio, sizeof (cio));
+ b_string_add (str, (unsigned char *) &type, sizeof (type));
+
+ b_io_write (data->journaling_io, str->string, str->size,
+ data->max_cache);
+ b_string_destroy (str, NULL);
+ break;
+
+ case B_JOURNALING_END_WRITE:
+ /* 1th argument: the pointer */
+ if (!(pointer = va_arg (va, b_uint64)))
+ return;
+
+ if (b_string_new (&str) != B_OK)
+ return;
+
+ b_string_add (str, (unsigned char *) &cio, sizeof (cio));
+ b_string_add (str, (unsigned char *) &type, sizeof (type));
+ b_string_add (str, (unsigned char *) &pointer, sizeof (pointer));
+
+ b_io_write (data->journaling_io, str->string, str->size,
+ data->max_cache);
+ b_string_destroy (str, NULL);
+ break;
+
+ case B_JOURNALING_WRITE:
+ /* 1th argument: the pointer */
+ if (!(pointer = va_arg (va, b_uint64)))
+ return;
+
+ /* 2nd argument: the size */
+ if (!(size = va_arg (va, size_t)))
+ return;
+
+ /* 3rd argument: what */
+ if (!(what = va_arg (va, void *)))
+ {
+ freed = 1;
+
+ if (!(what = malloc (size + 1)))
+ return;
+
+ if (b_io_read (io, what, size) <= 0)
+ return;
+ }
+ else
+ freed = 0;
+
+ if (b_string_new (&str) != B_OK)
+ {
+ if (freed)
+ free (what);
+ return;
+ }
+
+ b_string_add (str, (unsigned char *) &cio, sizeof (cio));
+ b_string_add (str, (unsigned char *) &type, sizeof (type));
+ b_string_add (str, (unsigned char *) &pointer, sizeof (pointer));
+ b_string_add (str, (unsigned char *) &size, sizeof (size));
+ b_string_add (str, (unsigned char *) what, size);
+
+ b_io_write (data->journaling_io, str->string, str->size,
+ data->max_cache);
+ b_string_destroy (str, NULL);
+
+ if (freed)
+ free (what);
+ break;
+ }
+
+ va_end (va);
+}
+
+/* The destroing procedure removes the file: */
+void
+b_journaling_destroy (b_t * data)
+{
+ data->journaling_io->end_pointer = sizeof (b_uint64);
+ memcpy (data->journaling_io->data, &data->journaling_io->end_pointer,
+ sizeof (data->journaling_io->end_pointer));
+}
+
+/* Witch io element? */
+static char
+b_journaling_io (b_t * data, b_io_t * io)
+{
+ if (data->uris_io == io)
+ return B_TYPE_URI;
+
+ if (data->properties_io == io)
+ return B_TYPE_PROPERTY;
+
+ if (data->literals_io == io)
+ return B_TYPE_LITERAL;
+
+ if (data->bnodes_io == io)
+ return B_TYPE_BNODE;
+
+ if (data->contexts_io == io)
+ return B_TYPE_CONTEXT;
+
+ if (data->datatypes_io == io)
+ return B_TYPE_DATATYPE;
+
+ return -1;
+}
+
+/* Recovering procedure: */
+b_error_t
+b_journaling_recover (b_t * data)
+{
+ b_uint64 done = 0;
+ char b;
+ b_io_t *io;
+
+ /* Until the file exists: */
+ while (b_io_read (data->journaling_io, &b, sizeof (char)) <= 0)
+ {
+ /* The first byte means the io element: */
+ switch (b)
+ {
+ case B_TYPE_URI:
+ io = data->uris_io;
+ break;
+
+ case B_TYPE_PROPERTY:
+ io = data->properties_io;
+ break;
+
+ case B_TYPE_LITERAL:
+ io = data->literals_io;
+ break;
+
+ case B_TYPE_BNODE:
+ io = data->bnodes_io;
+ break;
+
+ case B_TYPE_CONTEXT:
+ io = data->contexts_io;
+ break;
+
+ case B_TYPE_DATATYPE:
+ io = data->datatypes_io;
+ break;
+
+ case -1:
+ io = data->triples_io;
+ break;
+
+ default:
+ /* Error in the file: */
+ b_journaling_destroy (data);
+ return B_OK;
+ }
+
+ /* The second byte means the operation: */
+ if (b_io_read (data->journaling_io, &b, sizeof (char)) <= 0)
+ {
+ b_journaling_destroy (data);
+ return B_OK;
+ }
+
+ switch (b)
+ {
+ case B_JOURNALING_CACHE_EMPTY:
+ if (b_journaling_recover_cache_empty (data, io, &done) != B_OK)
+ {
+ b_journaling_destroy (data);
+ return B_OK;
+ }
+
+ break;
+
+ case B_JOURNALING_END_WRITE:
+ if (b_journaling_recover_end_write (data, io, &done) != B_OK)
+ {
+ b_journaling_destroy (data);
+ return B_OK;
+ }
+
+ break;
+
+ case B_JOURNALING_WRITE:
+ if (b_journaling_recover_write (data, io, &done) != B_OK)
+ {
+ b_journaling_destroy (data);
+ return B_OK;
+ }
+
+ break;
+
+ default:
+ /* Error in the file: */
+ b_journaling_destroy (data);
+ return B_OK;
+ }
+ }
+
+ b_journaling_destroy (data);
+ return B_OK;
+}
+
+/* If the crashed procedure was creating the empty element of a b-tree, I can
+ * reset the end_pointer: */
+static b_error_t
+b_journaling_recover_cache_empty (b_t * data, b_io_t * io, b_uint64 * done)
+{
+ io->end_pointer = sizeof (b_uint64);
+ memcpy (io->data, &io->end_pointer, sizeof (io->end_pointer));
+ return B_OK;
+}
+
+/* If the crashed procedure was writting something in the end of the file, I
+ * reset the end_pointer to the previous value: */
+static b_error_t
+b_journaling_recover_end_write (b_t * data, b_io_t * io, b_uint64 * done)
+{
+ b_uint64 pointer;
+
+ if (b_io_read (data->journaling_io, &pointer, sizeof (pointer)) <= 0)
+ return B_ERROR_POSIX;
+
+ io->end_pointer = pointer;
+ memcpy (io->data, &io->end_pointer, sizeof (io->end_pointer));
+
+ (*done) += sizeof (pointer);
+ return B_OK;
+}
+
+/* if the crashed procedure was writting in the middle of the file, I must
+ * write the previous value: */
+static b_error_t
+b_journaling_recover_write (b_t * data, b_io_t * io, b_uint64 * done)
+{
+ b_uint64 pointer;
+ size_t size;
+ unsigned char *what;
+
+ if (b_io_read (data->journaling_io, &pointer, sizeof (pointer)) <= 0)
+ return B_ERROR_POSIX;
+
+ if (b_io_read (data->journaling_io, &size, sizeof (size)) <= 0)
+ return B_ERROR_POSIX;
+
+ if (!(what = malloc (size)))
+ return B_ERROR_POSIX;
+
+ if (b_io_read (data->journaling_io, what, size) <= 0)
+ {
+ free (what);
+ return B_ERROR_POSIX;
+ }
+
+ b_io_seek (io, pointer, SEEK_SET);
+ b_io_write (io, what, size, data->max_cache);
+ free (what);
+
+ (*done) += size + sizeof (size) + sizeof (pointer);
+ return B_OK;
+}
+
+/* EOF */
Modified: incubator/triplesoup/code/trunk/libraries/b/bmd5.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bmd5.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bmd5.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bmd5.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,19 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
*
* Original copyright message:
*
Modified: incubator/triplesoup/code/trunk/libraries/b/bnew.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bnew.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bnew.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bnew.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -69,6 +76,33 @@
B_NEW_FD (B_PATH_CONTEXTS_DATA, contexts_io);
B_NEW_FD (B_PATH_DATATYPES_DATA, datatypes_io);
B_NEW_FD (B_PATH_TRIPLES_DATA, triples_io);
+
+ if (!
+ (file =
+ malloc (sizeof (char) *
+ (strlen ((char *) path) + strlen (B_PATH_JOURNALING_DATA) +
+ 1))))
+ {
+ b_destroy (*data);
+ return B_ERROR_MEMORY;
+ }
+
+ sprintf (file, "%s%s", path, B_PATH_JOURNALING_DATA);
+ error = b_io_new (&(*data)->journaling_io, (unsigned char *) file, n);
+ (*data)->journaling_file = (unsigned char *) file;
+
+ if (error != B_OK)
+ {
+ b_destroy (*data);
+ return error;
+ }
+
+ /* if it return a strange value, the DB is broken... */
+ if ((error = b_journaling_recover (*data)) != B_OK)
+ {
+ b_destroy (*data);
+ return error;
+ }
if ((error = b_count_triple_cache (*data, &(*data)->triples_total)))
{
Modified: incubator/triplesoup/code/trunk/libraries/b/bremove.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bremove.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bremove.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bremove.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -52,9 +59,18 @@
if (map.instances > 0)
return B_OK;
+ b_journaling_new (data, io, B_JOURNALING_WRITE, cache->pointer,
+ sizeof (b_map_t), &map);
+
b_io_seek (io, map.parent, SEEK_SET);
if (b_io_read (io, &parent, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE, map.parent,
+ sizeof (b_map_t), &parent);
/* 1 child or 0 children: */
if (!map.left)
@@ -70,13 +86,22 @@
b_io_seek (io, map.right, SEEK_SET);
if (b_io_read (io, &other, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE, map.right,
+ sizeof (b_map_t), &other);
other.parent = map.parent;
b_io_seek (io, map.right, SEEK_SET);
if (b_io_write (io, &other, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
}
}
@@ -93,13 +118,22 @@
b_io_seek (io, map.left, SEEK_SET);
if (b_io_read (io, &other, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE, map.left,
+ sizeof (b_map_t), &other);
other.parent = map.parent;
b_io_seek (io, map.left, SEEK_SET);
if (b_io_write (io, &other, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
}
}
@@ -112,15 +146,24 @@
/* I'm looking for the in-order successor: */
pointer = b_io_seek (io, map.right, SEEK_SET);
if (b_io_read (io, &other, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
while (other.left)
{
pointer = b_io_seek (io, other.left, SEEK_SET);
if (b_io_read (io, &other, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
}
+ b_journaling_new (data, io, B_JOURNALING_WRITE, pointer,
+ sizeof (b_map_t), &other);
+
/* I change the parent link: */
if (parent.left == cache->pointer)
parent.left = pointer;
@@ -135,7 +178,13 @@
b_io_seek (io, other.parent, SEEK_SET);
if (b_io_read (io, &other_p, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE, other.parent,
+ sizeof (b_map_t), &other_p);
if (other_p.left == pointer)
other_p.left = other.right;
@@ -145,32 +194,53 @@
b_io_seek (io, other.parent, SEEK_SET);
if (b_io_write (io, &other_p, sizeof (b_map_t), data->max_cache) <=
0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
if (other.right)
{
b_io_seek (io, other.right, SEEK_SET);
if (b_io_read (io, &other_r, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE,
+ other.right, sizeof (b_map_t), &other_r);
other_r.parent = other.parent;
b_io_seek (io, other.right, SEEK_SET);
if (b_io_write (io, &other_r, sizeof (b_map_t), data->max_cache)
<= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
}
b_io_seek (io, map.right, SEEK_SET);
if (b_io_read (io, &other_r, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE, map.right,
+ sizeof (b_map_t), &other_r);
other_r.parent = pointer;
b_io_seek (io, map.right, SEEK_SET);
if (b_io_write (io, &other_r, sizeof (b_map_t), data->max_cache) <=
0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
other.right = map.right;
}
@@ -181,32 +251,51 @@
b_io_seek (io, pointer, SEEK_SET);
if (b_io_write (io, &other, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
/* The left child: */
b_io_seek (io, map.left, SEEK_SET);
if (b_io_read (io, &other, sizeof (b_map_t)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE, map.left,
+ sizeof (b_map_t), &other);
other.parent = pointer;
b_io_seek (io, map.left, SEEK_SET);
if (b_io_write (io, &other, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
}
/* sync the parent: */
b_io_seek (io, map.parent, SEEK_SET);
if (b_io_write (io, &parent, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
/* Sync the node: */
b_hash_zero (map.hash);
b_io_seek (io, cache->pointer, SEEK_SET);
if (b_io_write (io, &map, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+ b_journaling_destroy (data);
return B_OK;
}
@@ -234,9 +323,7 @@
/* if it doesn't exist? */
if ((error = b_get_triple_cache (data, triple, &cache)) != B_OK || !cache)
- {
- return error;
- }
+ return error;
if (cache->tmap_pointer)
{
@@ -248,13 +335,16 @@
if (b_io_read (data->triples_io, &tmap, sizeof (b_tmap_t)) <= 0)
return B_ERROR_INTERNAL;
+ b_journaling_new (data, data->triples_io, B_JOURNALING_WRITE,
+ cache->tmap_pointer, sizeof (b_tmap_t), &tmap);
+
s_uri = s_bnode = p = o_uri = o_bnode = o_literal = c = d = l = 0;
for (i = 0; i < B_TMAP_NUMB; i++)
{
#define B_REMOVE_SWITCH( x , a ) \
- if(!x && B_TMAP_DATA (tmap.a[i])==cache->tmap_index) \
+ if(!x && B_TMAP_DATA (tmap.a[i]) == cache->tmap_index) \
x++; \
\
if (x) \
@@ -280,9 +370,14 @@
b_io_seek (data->triples_io, cache->tmap_pointer, SEEK_SET);
- if (b_io_write (data->triples_io, &tmap, sizeof (tmap), data->max_cache)
- <= 0)
- return B_ERROR_POSIX;
+ if (b_io_write
+ (data->triples_io, &tmap, sizeof (b_tmap_t), data->max_cache) <= 0)
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_POSIX;
+ }
+
+ b_journaling_destroy (data);
if ((error =
b_tempty_check (data, &tmap, cache->tmap_pointer, 0)) != B_OK)
Modified: incubator/triplesoup/code/trunk/libraries/b/bstring.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bstring.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bstring.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bstring.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
Modified: incubator/triplesoup/code/trunk/libraries/b/bsync.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/bsync.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/bsync.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/bsync.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -68,8 +75,16 @@
{
b_error_t err;
+ /* This write must be protected: */
+ b_journaling_new (data, io, B_JOURNALING_CACHE_EMPTY);
+
if ((err = b_sync_cache_empty (data, io)) != B_OK)
- return err;
+ {
+ b_journaling_destroy (data);
+ return err;
+ }
+
+ b_journaling_destroy (data);
/* Recursion: */
return b_sync_cache (data, io, hash, what, len);
@@ -101,25 +116,44 @@
/* Write the new element: */
end = b_io_seek (io, 0, SEEK_END);
- if (b_io_write
- (io, &map, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_POSIX;
+ b_journaling_new (data, io, B_JOURNALING_END_WRITE, end);
+
+ if (b_io_write (io, &map, sizeof (b_map_t), data->max_cache) <=
+ 0)
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_POSIX;
+ }
if (map.len
&& b_io_write (io, what, map.len, data->max_cache) <= 0)
- return B_ERROR_POSIX;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_POSIX;
+ }
/* Set the left node to the parent: */
b_io_seek (io, pointer, SEEK_SET);
if (b_io_read (io, &m, sizeof (m)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE, pointer,
+ sizeof (b_map_t), &m);
m.left = end;
b_io_seek (io, pointer, SEEK_SET);
+
if (b_io_write (io, &m, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_POSIX;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_POSIX;
+ }
+ b_journaling_destroy (data);
return B_OK;
}
}
@@ -139,25 +173,44 @@
/* Write the new element: */
end = b_io_seek (io, 0, SEEK_END);
- if (b_io_write
- (io, &map, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_POSIX;
+ b_journaling_new (data, io, B_JOURNALING_END_WRITE, end);
+
+ if (b_io_write (io, &map, sizeof (b_map_t), data->max_cache) <=
+ 0)
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_POSIX;
+ }
if (map.len
&& b_io_write (io, what, map.len, data->max_cache) <= 0)
- return B_ERROR_POSIX;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_POSIX;
+ }
/* Set the right node to the parent: */
b_io_seek (io, pointer, SEEK_SET);
if (b_io_read (io, &m, sizeof (m)) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_new (data, io, B_JOURNALING_WRITE, pointer,
+ sizeof (b_map_t), &m);
m.right = end;
b_io_seek (io, pointer, SEEK_SET);
+
if (b_io_write (io, &m, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_POSIX;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_POSIX;
+ }
+ b_journaling_destroy (data);
return B_OK;
}
}
@@ -172,21 +225,39 @@
{
b_map_t map;
b_error_t err;
+ b_string_t *str;
memset (&map, 0, sizeof (b_map_t));
+ map.len = 1;
if ((err = b_hash_new (data, (unsigned char *) "", 0, map.hash)) != B_OK)
return err;
b_io_seek (io, sizeof (b_uint64), SEEK_SET);
- if (b_io_write (io, &map, sizeof (b_map_t), data->max_cache) <= 0)
- return B_ERROR_POSIX;
+ if ((err = b_string_new (&str)) != B_OK)
+ return err;
- if (map.len && b_io_write (io, "", 1, data->max_cache) <= 0)
- return B_ERROR_POSIX;
+ if ((err =
+ b_string_add (str, (unsigned char *) &map, sizeof (b_map_t))) != B_OK)
+ {
+ b_string_destroy (str, NULL);
+ return err;
+ }
- return B_OK;
+ if ((err = b_string_add (str, (unsigned char *) "", 1)) != B_OK)
+ {
+ b_string_destroy (str, NULL);
+ return err;
+ }
+
+ if (b_io_write (io, str->string, str->size, data->max_cache) <= 0)
+ {
+ b_string_destroy (str, NULL);
+ return B_ERROR_POSIX;
+ }
+
+ return b_string_destroy (str, NULL);
}
/* This function syncs a single triple list: */
@@ -404,6 +475,9 @@
&write_data)) != B_OK)
return error;
+ b_journaling_new (data, data->triples_io,
+ B_JOURNALING_END_WRITE, pointer);
+
b_string_add (str, (unsigned char *) &tmap, sizeof (tmap));
/* ...and later the triples: */
@@ -442,15 +516,25 @@
/* Destroy of the b_string_t: */
b_string_destroy (str, NULL);
+
+ b_journaling_destroy (data);
}
else
{
- b_io_seek (data->triples_io, pointer, SEEK_SET);
+ b_uint64 pnew = pointer;
+
+ pnew = b_io_seek (data->triples_io, pointer, SEEK_SET);
+
+ b_journaling_new (data, data->triples_io, B_JOURNALING_WRITE,
+ pnew, sizeof (b_tmap_t), NULL);
if (b_io_write
(data->triples_io, &tmap, sizeof (b_tmap_t),
data->max_cache) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
for (i = 0; i < B_TMAP_NUMB; i++)
{
@@ -465,10 +549,17 @@
else \
memset (&tmap_item, 0, sizeof (b_tmap_item_t)); \
\
+ b_journaling_new (data, data->triples_io, \
+ B_JOURNALING_WRITE, pnew, \
+ sizeof(b_tmap_item_t), NULL); \
+ \
if (b_io_write (data->triples_io, &tmap_item, \
sizeof (b_tmap_item_t), data->max_cache) \
<= 0) \
- return B_ERROR_INTERNAL;
+ { \
+ b_journaling_destroy (data); \
+ return B_ERROR_INTERNAL; \
+ }
B_SYNC_TCACHE3 (subject_uri);
B_SYNC_TCACHE3 (subject_bnode);
@@ -481,8 +572,10 @@
B_SYNC_TCACHE3 (lang);
}
else
- b_io_seek (data->triples_io, B_TRIPLE_SIZE, SEEK_CUR);
+ pnew = b_io_seek (data->triples_io, B_TRIPLE_SIZE, SEEK_CUR);
}
+
+ b_journaling_destroy (data);
}
for (i = 0; i < B_TMAP_NUMB; i++)
@@ -588,12 +681,20 @@
if (b_io_read (io, &instances, sizeof (instances)) <= 0)
return B_ERROR_INTERNAL;
+ b_journaling_new (data, io, B_JOURNALING_WRITE, pointer,
+ sizeof (b_uint64), &instances);
+
instances += (add > 0 ? 1 : -1);
b_io_seek (io, pointer, SEEK_SET);
if (b_io_write (io, &instances, sizeof (instances), data->max_cache) <= 0)
- return B_ERROR_INTERNAL;
+ {
+ b_journaling_destroy (data);
+ return B_ERROR_INTERNAL;
+ }
+
+ b_journaling_destroy (data);
if (instances <= 0)
return b_remove_type_cache (data, io, cache);
Modified: incubator/triplesoup/code/trunk/libraries/b/btcache.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/btcache.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/btcache.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/btcache.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -96,7 +103,10 @@
if (src->x) \
{ \
if ((error = b_cache_copy (src->x, &new->x)) != B_OK) \
- return error; \
+ { \
+ b_tcache_destroy_single (NULL, NULL, new); \
+ return error; \
+ } \
}
B_COPY_TCACHE (subject_uri);
@@ -134,7 +144,10 @@
if (src->x) \
{ \
if ((error = b_cache_copy_easy (src->x, &new->x)) != B_OK) \
- return error; \
+ { \
+ b_tcache_destroy_single (NULL, NULL, new); \
+ return error; \
+ } \
}
B_COPY_TCACHE_EASY (subject_uri);
Modified: incubator/triplesoup/code/trunk/libraries/b/btempty.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/btempty.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/btempty.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/btempty.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
@@ -45,6 +52,7 @@
return B_OK;
}
+
/* Is it already in the list? */
for (te = data->triples_empty; te; te = te->next)
{
Modified: incubator/triplesoup/code/trunk/libraries/b/btimer.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/btimer.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/btimer.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/btimer.c Fri Apr 13 09:09:20 2007
@@ -1,16 +1,23 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>
#ifdef WIN32
-int
+static int
gettimeofday (struct timeval *tv, void *tz)
{
struct _timeb timebuffer;
Modified: incubator/triplesoup/code/trunk/libraries/b/btriple.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/libraries/b/btriple.c?view=diff&rev=528542&r1=528541&r2=528542
==============================================================================
--- incubator/triplesoup/code/trunk/libraries/b/btriple.c (original)
+++ incubator/triplesoup/code/trunk/libraries/b/btriple.c Fri Apr 13 09:09:20 2007
@@ -1,10 +1,17 @@
-/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <b.h>