Merge pull request #5365 from libgit2/ethomson/no_void Return int from non-free functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725
diff --git a/include/git2/attr.h b/include/git2/attr.h
index 72e4380..a3ab5a7 100644
--- a/include/git2/attr.h
+++ b/include/git2/attr.h
@@ -238,8 +238,11 @@ GIT_EXTERN(int) git_attr_foreach(
* disk no longer match the cached contents of memory. This will cause
* the attributes files to be reloaded the next time that an attribute
* access function is called.
+ *
+ * @param repo The repository containing the gitattributes cache
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_attr_cache_flush(
+GIT_EXTERN(int) git_attr_cache_flush(
git_repository *repo);
/**
diff --git a/include/git2/common.h b/include/git2/common.h
index 947e408..d669606 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -117,8 +117,9 @@ GIT_BEGIN_DECL
* @param major Store the major version number
* @param minor Store the minor version number
* @param rev Store the revision (patch) number
+ * @return 0 on success or an error code on failure
*/
-GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
+GIT_EXTERN(int) git_libgit2_version(int *major, int *minor, int *rev);
/**
* Combinations of these values describe the features with which libgit2
diff --git a/include/git2/errors.h b/include/git2/errors.h
index 370b6ac..5c85c4d 100644
--- a/include/git2/errors.h
+++ b/include/git2/errors.h
@@ -143,8 +143,9 @@ GIT_EXTERN(void) git_error_clear(void);
* @param error_class One of the `git_error_t` enum above describing the
* general subsystem that is responsible for the error.
* @param string The formatted error message to keep
+ * @return 0 on success or -1 on failure
*/
-GIT_EXTERN(void) git_error_set_str(int error_class, const char *string);
+GIT_EXTERN(int) git_error_set_str(int error_class, const char *string);
/**
* Set the error message to a special value for memory allocation failure.
diff --git a/include/git2/oid.h b/include/git2/oid.h
index 8f27c13..549df4e 100644
--- a/include/git2/oid.h
+++ b/include/git2/oid.h
@@ -73,8 +73,9 @@ GIT_EXTERN(int) git_oid_fromstrn(git_oid *out, const char *str, size_t length);
*
* @param out oid structure the result is written into.
* @param raw the raw input bytes to be copied.
+ * @return 0 on success or error code
*/
-GIT_EXTERN(void) git_oid_fromraw(git_oid *out, const unsigned char *raw);
+GIT_EXTERN(int) git_oid_fromraw(git_oid *out, const unsigned char *raw);
/**
* Format a git_oid into a hex string.
@@ -85,8 +86,9 @@ GIT_EXTERN(void) git_oid_fromraw(git_oid *out, const unsigned char *raw);
* oid digits are written; a '\\0' terminator must be added
* by the caller if it is required.
* @param id oid structure to format.
+ * @return 0 on success or error code
*/
-GIT_EXTERN(void) git_oid_fmt(char *out, const git_oid *id);
+GIT_EXTERN(int) git_oid_fmt(char *out, const git_oid *id);
/**
* Format a git_oid into a partial hex string.
@@ -96,8 +98,9 @@ GIT_EXTERN(void) git_oid_fmt(char *out, const git_oid *id);
* will be zeroed; if not, a '\0' terminator is NOT added.
* @param n number of characters to write into out string
* @param id oid structure to format.
+ * @return 0 on success or error code
*/
-GIT_EXTERN(void) git_oid_nfmt(char *out, size_t n, const git_oid *id);
+GIT_EXTERN(int) git_oid_nfmt(char *out, size_t n, const git_oid *id);
/**
* Format a git_oid into a loose-object path string.
@@ -111,8 +114,9 @@ GIT_EXTERN(void) git_oid_nfmt(char *out, size_t n, const git_oid *id);
* oid digits are written; a '\\0' terminator must be added
* by the caller if it is required.
* @param id oid structure to format.
+ * @return 0 on success, non-zero callback return value, or error code
*/
-GIT_EXTERN(void) git_oid_pathfmt(char *out, const git_oid *id);
+GIT_EXTERN(int) git_oid_pathfmt(char *out, const git_oid *id);
/**
* Format a git_oid into a statically allocated c-string.
@@ -151,8 +155,9 @@ GIT_EXTERN(char *) git_oid_tostr(char *out, size_t n, const git_oid *id);
*
* @param out oid structure the result is written into.
* @param src oid structure to copy from.
+ * @return 0 on success or error code
*/
-GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src);
+GIT_EXTERN(int) git_oid_cpy(git_oid *out, const git_oid *src);
/**
* Compare two oid structures.
diff --git a/include/git2/remote.h b/include/git2/remote.h
index f9454d6..a6ed4cb 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -378,8 +378,9 @@ GIT_EXTERN(int) git_remote_connected(const git_remote *remote);
* the operation has been cancelled and if so stops the operation.
*
* @param remote the remote
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_remote_stop(git_remote *remote);
+GIT_EXTERN(int) git_remote_stop(git_remote *remote);
/**
* Disconnect from the remote
@@ -387,8 +388,9 @@ GIT_EXTERN(void) git_remote_stop(git_remote *remote);
* Close the connection to the remote.
*
* @param remote the remote to disconnect from
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_remote_disconnect(git_remote *remote);
+GIT_EXTERN(int) git_remote_disconnect(git_remote *remote);
/**
* Free the memory associated with a remote
diff --git a/include/git2/revwalk.h b/include/git2/revwalk.h
index 9cb0d0a..98dcbf8 100644
--- a/include/git2/revwalk.h
+++ b/include/git2/revwalk.h
@@ -84,8 +84,9 @@ GIT_EXTERN(int) git_revwalk_new(git_revwalk **out, git_repository *repo);
* is over.
*
* @param walker handle to reset.
+ * @return 0 or an error code
*/
-GIT_EXTERN(void) git_revwalk_reset(git_revwalk *walker);
+GIT_EXTERN(int) git_revwalk_reset(git_revwalk *walker);
/**
* Add a new root for the traversal
@@ -224,8 +225,9 @@ GIT_EXTERN(int) git_revwalk_next(git_oid *out, git_revwalk *walk);
*
* @param walk the walker being used for the traversal.
* @param sort_mode combination of GIT_SORT_XXX flags
+ * @return 0 or an error code
*/
-GIT_EXTERN(void) git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode);
+GIT_EXTERN(int) git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode);
/**
* Push and hide the respective endpoints of the given range.
@@ -246,8 +248,10 @@ GIT_EXTERN(int) git_revwalk_push_range(git_revwalk *walk, const char *range);
* Simplify the history by first-parent
*
* No parents other than the first for each commit will be enqueued.
+ *
+ * @return 0 or an error code
*/
-GIT_EXTERN(void) git_revwalk_simplify_first_parent(git_revwalk *walk);
+GIT_EXTERN(int) git_revwalk_simplify_first_parent(git_revwalk *walk);
/**
diff --git a/include/git2/sys/index.h b/include/git2/sys/index.h
index f1900df..1f6d93f 100644
--- a/include/git2/sys/index.h
+++ b/include/git2/sys/index.h
@@ -75,8 +75,9 @@ GIT_EXTERN(int) git_index_name_add(git_index *index,
* Remove all filename conflict entries.
*
* @param index an existing index object
+ * @return 0 or an error code
*/
-GIT_EXTERN(void) git_index_name_clear(git_index *index);
+GIT_EXTERN(int) git_index_name_clear(git_index *index);
/**@}*/
@@ -170,8 +171,9 @@ GIT_EXTERN(int) git_index_reuc_remove(git_index *index, size_t n);
* Remove all resolve undo entries from the index
*
* @param index an existing index object
+ * @return 0 or an error code
*/
-GIT_EXTERN(void) git_index_reuc_clear(git_index *index);
+GIT_EXTERN(int) git_index_reuc_clear(git_index *index);
/**@}*/
diff --git a/include/git2/sys/mempack.h b/include/git2/sys/mempack.h
index 63fb38d..17da590 100644
--- a/include/git2/sys/mempack.h
+++ b/include/git2/sys/mempack.h
@@ -78,8 +78,9 @@ GIT_EXTERN(int) git_mempack_dump(git_buf *pack, git_repository *repo, git_odb_ba
* semantics to the Git repository.
*
* @param backend The mempack backend
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(void) git_mempack_reset(git_odb_backend *backend);
+GIT_EXTERN(int) git_mempack_reset(git_odb_backend *backend);
GIT_END_DECL
diff --git a/include/git2/sys/repository.h b/include/git2/sys/repository.h
index ea2773f..892be66 100644
--- a/include/git2/sys/repository.h
+++ b/include/git2/sys/repository.h
@@ -44,8 +44,11 @@ GIT_EXTERN(int) git_repository_new(git_repository **out);
* trying to aggressively cleanup the repo before its
* deallocation. `git_repository_free` already performs this operation
* before deallocating the repo.
+ *
+ * @param repo The repository to clean up
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_repository__cleanup(git_repository *repo);
+GIT_EXTERN(int) git_repository__cleanup(git_repository *repo);
/**
* Update the filesystem config settings for an open repository
@@ -78,8 +81,9 @@ GIT_EXTERN(int) git_repository_reinit_filesystem(
*
* @param repo A repository object
* @param config A Config object
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *config);
+GIT_EXTERN(int) git_repository_set_config(git_repository *repo, git_config *config);
/**
* Set the Object Database for this repository
@@ -93,8 +97,9 @@ GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *con
*
* @param repo A repository object
* @param odb An ODB object
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb);
+GIT_EXTERN(int) git_repository_set_odb(git_repository *repo, git_odb *odb);
/**
* Set the Reference Database Backend for this repository
@@ -108,8 +113,9 @@ GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb);
*
* @param repo A repository object
* @param refdb An refdb object
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_repository_set_refdb(git_repository *repo, git_refdb *refdb);
+GIT_EXTERN(int) git_repository_set_refdb(git_repository *repo, git_refdb *refdb);
/**
* Set the index file for this repository
@@ -123,8 +129,9 @@ GIT_EXTERN(void) git_repository_set_refdb(git_repository *repo, git_refdb *refdb
*
* @param repo A repository object
* @param index An index object
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index);
+GIT_EXTERN(int) git_repository_set_index(git_repository *repo, git_index *index);
/**
* Set a repository to be bare.
diff --git a/include/git2/tree.h b/include/git2/tree.h
index 4455d2e..1a8e155 100644
--- a/include/git2/tree.h
+++ b/include/git2/tree.h
@@ -258,8 +258,9 @@ GIT_EXTERN(int) git_treebuilder_new(
* Clear all the entires in the builder
*
* @param bld Builder to clear
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(void) git_treebuilder_clear(git_treebuilder *bld);
+GIT_EXTERN(int) git_treebuilder_clear(git_treebuilder *bld);
/**
* Get the number of entries listed in a treebuilder
@@ -357,8 +358,9 @@ typedef int GIT_CALLBACK(git_treebuilder_filter_cb)(
* @param bld Tree builder
* @param filter Callback to filter entries
* @param payload Extra data to pass to filter callback
+ * @return 0 on success, non-zero callback return value, or error code
*/
-GIT_EXTERN(void) git_treebuilder_filter(
+GIT_EXTERN(int) git_treebuilder_filter(
git_treebuilder *bld,
git_treebuilder_filter_cb filter,
void *payload);
diff --git a/src/attrcache.c b/src/attrcache.c
index 21a1fea..f02dd9d 100644
--- a/src/attrcache.c
+++ b/src/attrcache.c
@@ -411,7 +411,7 @@ cancel:
return ret;
}
-void git_attr_cache_flush(git_repository *repo)
+int git_attr_cache_flush(git_repository *repo)
{
git_attr_cache *cache;
@@ -420,6 +420,8 @@ void git_attr_cache_flush(git_repository *repo)
*/
if (repo && (cache = git__swap(repo->attrcache, NULL)) != NULL)
attr_cache__free(cache);
+
+ return 0;
}
int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro)
diff --git a/src/errors.c b/src/errors.c
index c75f6b1..b34aa3a 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -95,19 +95,25 @@ void git_error_vset(int error_class, const char *fmt, va_list ap)
set_error_from_buffer(error_class);
}
-void git_error_set_str(int error_class, const char *string)
+int git_error_set_str(int error_class, const char *string)
{
git_buf *buf = &GIT_GLOBAL->error_buf;
assert(string);
- if (!string)
- return;
+ if (!string) {
+ git_error_set(GIT_ERROR_INVALID, "unspecified caller error");
+ return -1;
+ }
git_buf_clear(buf);
git_buf_puts(buf, string);
- if (!git_buf_oom(buf))
- set_error_from_buffer(error_class);
+
+ if (git_buf_oom(buf))
+ return -1;
+
+ set_error_from_buffer(error_class);
+ return 0;
}
void git_error_clear(void)
diff --git a/src/index.c b/src/index.c
index e2a8c7b..907bd6d 100644
--- a/src/index.c
+++ b/src/index.c
@@ -539,13 +539,19 @@ int git_index_clear(git_index *index)
git_idxmap_clear(index->entries_map);
while (!error && index->entries.length > 0)
error = index_remove_entry(index, index->entries.length - 1);
+
+ if (error)
+ goto done;
+
index_free_deleted(index);
- git_index_reuc_clear(index);
- git_index_name_clear(index);
+ if ((error = git_index_name_clear(index)) < 0 ||
+ (error = git_index_reuc_clear(index)) < 0)
+ goto done;
git_futils_filestamp_set(&index->stamp, NULL);
+done:
return error;
}
@@ -2136,7 +2142,7 @@ int git_index_name_add(git_index *index,
return 0;
}
-void git_index_name_clear(git_index *index)
+int git_index_name_clear(git_index *index)
{
size_t i;
git_index_name_entry *conflict_name;
@@ -2149,6 +2155,8 @@ void git_index_name_clear(git_index *index)
git_vector_clear(&index->names);
index->dirty = 1;
+
+ return 0;
}
size_t git_index_reuc_entrycount(git_index *index)
@@ -2245,7 +2253,7 @@ int git_index_reuc_remove(git_index *index, size_t position)
return error;
}
-void git_index_reuc_clear(git_index *index)
+int git_index_reuc_clear(git_index *index)
{
size_t i;
@@ -2257,6 +2265,8 @@ void git_index_reuc_clear(git_index *index)
git_vector_clear(&index->reuc);
index->dirty = 1;
+
+ return 0;
}
static int index_error_invalid(const char *message)
@@ -3277,8 +3287,9 @@ static int git_index_read_iterator(
}
}
- git_index_name_clear(index);
- git_index_reuc_clear(index);
+ if ((error = git_index_name_clear(index)) < 0 ||
+ (error = git_index_reuc_clear(index)) < 0)
+ goto done;
git_vector_swap(&new_entries, &index->entries);
new_entries_map = git__swap(index->entries_map, new_entries_map);
diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index 6728c6c..69c423b 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -125,7 +125,7 @@ cleanup:
return err;
}
-void git_mempack_reset(git_odb_backend *_backend)
+int git_mempack_reset(git_odb_backend *_backend)
{
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
struct memobject *object = NULL;
@@ -137,6 +137,8 @@ void git_mempack_reset(git_odb_backend *_backend)
git_array_clear(db->commits);
git_oidmap_clear(db->objects);
+
+ return 0;
}
static void impl__free(git_odb_backend *_backend)
diff --git a/src/oid.c b/src/oid.c
index 605c1e6..6419566 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -64,13 +64,13 @@ GIT_INLINE(char) *fmt_one(char *str, unsigned int val)
return str;
}
-void git_oid_nfmt(char *str, size_t n, const git_oid *oid)
+int git_oid_nfmt(char *str, size_t n, const git_oid *oid)
{
size_t i, max_i;
if (!oid) {
memset(str, 0, n);
- return;
+ return 0;
}
if (n > GIT_OID_HEXSZ) {
memset(&str[GIT_OID_HEXSZ], 0, n - GIT_OID_HEXSZ);
@@ -84,14 +84,16 @@ void git_oid_nfmt(char *str, size_t n, const git_oid *oid)
if (n & 1)
*str++ = to_hex[oid->id[i] >> 4];
+
+ return 0;
}
-void git_oid_fmt(char *str, const git_oid *oid)
+int git_oid_fmt(char *str, const git_oid *oid)
{
- git_oid_nfmt(str, GIT_OID_HEXSZ, oid);
+ return git_oid_nfmt(str, GIT_OID_HEXSZ, oid);
}
-void git_oid_pathfmt(char *str, const git_oid *oid)
+int git_oid_pathfmt(char *str, const git_oid *oid)
{
size_t i;
@@ -99,6 +101,8 @@ void git_oid_pathfmt(char *str, const git_oid *oid)
*str++ = '/';
for (i = 1; i < sizeof(oid->id); i++)
str = fmt_one(str, oid->id[i]);
+
+ return 0;
}
char *git_oid_tostr_s(const git_oid *oid)
@@ -167,14 +171,16 @@ void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid)
git_buf_putc(buf, '\n');
}
-void git_oid_fromraw(git_oid *out, const unsigned char *raw)
+int git_oid_fromraw(git_oid *out, const unsigned char *raw)
{
memcpy(out->id, raw, sizeof(out->id));
+ return 0;
}
-void git_oid_cpy(git_oid *out, const git_oid *src)
+int git_oid_cpy(git_oid *out, const git_oid *src)
{
memcpy(out->id, src->id, sizeof(out->id));
+ return 0;
}
int git_oid_cmp(const git_oid *a, const git_oid *b)
diff --git a/src/remote.c b/src/remote.c
index 19aa45d..e65d036 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1676,20 +1676,24 @@ int git_remote_connected(const git_remote *remote)
return remote->transport->is_connected(remote->transport);
}
-void git_remote_stop(git_remote *remote)
+int git_remote_stop(git_remote *remote)
{
assert(remote);
if (remote->transport && remote->transport->cancel)
remote->transport->cancel(remote->transport);
+
+ return 0;
}
-void git_remote_disconnect(git_remote *remote)
+int git_remote_disconnect(git_remote *remote)
{
assert(remote);
if (git_remote_connected(remote))
remote->transport->close(remote->transport);
+
+ return 0;
}
void git_remote_free(git_remote *remote)
diff --git a/src/repository.c b/src/repository.c
index 03f6820..2469e13 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -138,7 +138,7 @@ static void set_index(git_repository *repo, git_index *index)
}
}
-void git_repository__cleanup(git_repository *repo)
+int git_repository__cleanup(git_repository *repo)
{
assert(repo);
@@ -150,6 +150,8 @@ void git_repository__cleanup(git_repository *repo)
set_index(repo, NULL);
set_odb(repo, NULL);
set_refdb(repo, NULL);
+
+ return 0;
}
void git_repository_free(git_repository *repo)
@@ -1070,10 +1072,11 @@ int git_repository_config_snapshot(git_config **out, git_repository *repo)
return git_config_snapshot(out, weak);
}
-void git_repository_set_config(git_repository *repo, git_config *config)
+int git_repository_set_config(git_repository *repo, git_config *config)
{
assert(repo && config);
set_config(repo, config);
+ return 0;
}
int git_repository_odb__weakptr(git_odb **out, git_repository *repo)
@@ -1121,10 +1124,11 @@ int git_repository_odb(git_odb **out, git_repository *repo)
return 0;
}
-void git_repository_set_odb(git_repository *repo, git_odb *odb)
+int git_repository_set_odb(git_repository *repo, git_odb *odb)
{
assert(repo && odb);
set_odb(repo, odb);
+ return 0;
}
int git_repository_refdb__weakptr(git_refdb **out, git_repository *repo)
@@ -1161,10 +1165,11 @@ int git_repository_refdb(git_refdb **out, git_repository *repo)
return 0;
}
-void git_repository_set_refdb(git_repository *repo, git_refdb *refdb)
+int git_repository_set_refdb(git_repository *repo, git_refdb *refdb)
{
assert(repo && refdb);
set_refdb(repo, refdb);
+ return 0;
}
int git_repository_index__weakptr(git_index **out, git_repository *repo)
@@ -1210,10 +1215,11 @@ int git_repository_index(git_index **out, git_repository *repo)
return 0;
}
-void git_repository_set_index(git_repository *repo, git_index *index)
+int git_repository_set_index(git_repository *repo, git_index *index)
{
assert(repo);
set_index(repo, index);
+ return 0;
}
int git_repository_set_namespace(git_repository *repo, const char *namespace)
diff --git a/src/revwalk.c b/src/revwalk.c
index 6f49bf2..4587b5a 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -700,7 +700,7 @@ git_repository *git_revwalk_repository(git_revwalk *walk)
return walk->repo;
}
-void git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode)
+int git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode)
{
assert(walk);
@@ -719,11 +719,14 @@ void git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode)
if (walk->sorting != GIT_SORT_NONE)
walk->limited = 1;
+
+ return 0;
}
-void git_revwalk_simplify_first_parent(git_revwalk *walk)
+int git_revwalk_simplify_first_parent(git_revwalk *walk)
{
walk->first_parent = 1;
+ return 0;
}
int git_revwalk_next(git_oid *oid, git_revwalk *walk)
@@ -752,7 +755,7 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
return error;
}
-void git_revwalk_reset(git_revwalk *walk)
+int git_revwalk_reset(git_revwalk *walk)
{
git_commit_list_node *commit;
@@ -777,6 +780,8 @@ void git_revwalk_reset(git_revwalk *walk)
walk->limited = 0;
walk->did_push = walk->did_hide = 0;
walk->sorting = GIT_SORT_NONE;
+
+ return 0;
}
int git_revwalk_add_hide_cb(
diff --git a/src/settings.c b/src/settings.c
index 6fae49e..f9f6b84 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -29,11 +29,13 @@
#include "streams/openssl.h"
#include "streams/mbedtls.h"
-void git_libgit2_version(int *major, int *minor, int *rev)
+int git_libgit2_version(int *major, int *minor, int *rev)
{
*major = LIBGIT2_VER_MAJOR;
*minor = LIBGIT2_VER_MINOR;
*rev = LIBGIT2_VER_REVISION;
+
+ return 0;
}
int git_libgit2_features(void)
diff --git a/src/tree.c b/src/tree.c
index cd6ab9b..48468df 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -834,7 +834,7 @@ out:
return error;
}
-void git_treebuilder_filter(
+int git_treebuilder_filter(
git_treebuilder *bld,
git_treebuilder_filter_cb filter,
void *payload)
@@ -850,9 +850,11 @@ void git_treebuilder_filter(
git_tree_entry_free(entry);
}
});
+
+ return 0;
}
-void git_treebuilder_clear(git_treebuilder *bld)
+int git_treebuilder_clear(git_treebuilder *bld)
{
git_tree_entry *e;
@@ -860,6 +862,8 @@ void git_treebuilder_clear(git_treebuilder *bld)
git_strmap_foreach_value(bld->map, e, git_tree_entry_free(e));
git_strmap_clear(bld->map);
+
+ return 0;
}
void git_treebuilder_free(git_treebuilder *bld)