Skip to content

Commit 662eee1

Browse files
committed
examples: general: convert C99 comments to C90 comments
1 parent c313e3d commit 662eee1

File tree

1 file changed

+54
-42
lines changed

1 file changed

+54
-42
lines changed

examples/general.c

Lines changed: 54 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,37 @@
1212
* <http://creativecommons.org/publicdomain/zero/1.0/>.
1313
*/
1414

15-
// [**libgit2**][lg] is a portable, pure C implementation of the Git core
16-
// methods provided as a re-entrant linkable library with a solid API,
17-
// allowing you to write native speed custom Git applications in any
18-
// language which supports C bindings.
19-
//
20-
// This file is an example of using that API in a real, compilable C file.
21-
// As the API is updated, this file will be updated to demonstrate the new
22-
// functionality.
23-
//
24-
// If you're trying to write something in C using [libgit2][lg], you should
25-
// also check out the generated [API documentation][ap]. We try to link to
26-
// the relevant sections of the API docs in each section in this file.
27-
//
28-
// **libgit2** (for the most part) only implements the core plumbing
29-
// functions, not really the higher level porcelain stuff. For a primer on
30-
// Git Internals that you will need to know to work with Git at this level,
31-
// check out [Chapter 10][pg] of the Pro Git book.
32-
//
33-
// [lg]: http://libgit2.github.com
34-
// [ap]: http://libgit2.github.com/libgit2
35-
// [pg]: https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain
36-
37-
// ### Includes
38-
39-
// Including the `git2.h` header will include all the other libgit2 headers
40-
// that you need. It should be the only thing you need to include in order
41-
// to compile properly and get all the libgit2 API.
15+
/**
16+
* [**libgit2**][lg] is a portable, pure C implementation of the Git core
17+
* methods provided as a re-entrant linkable library with a solid API,
18+
* allowing you to write native speed custom Git applications in any
19+
* language which supports C bindings.
20+
*
21+
* This file is an example of using that API in a real, compilable C file.
22+
* As the API is updated, this file will be updated to demonstrate the new
23+
* functionality.
24+
*
25+
* If you're trying to write something in C using [libgit2][lg], you should
26+
* also check out the generated [API documentation][ap]. We try to link to
27+
* the relevant sections of the API docs in each section in this file.
28+
*
29+
* **libgit2** (for the most part) only implements the core plumbing
30+
* functions, not really the higher level porcelain stuff. For a primer on
31+
* Git Internals that you will need to know to work with Git at this level,
32+
* check out [Chapter 10][pg] of the Pro Git book.
33+
*
34+
* [lg]: http://libgit2.github.com
35+
* [ap]: http://libgit2.github.com/libgit2
36+
* [pg]: https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain
37+
*/
38+
39+
/**
40+
* ### Includes
41+
*
42+
* Including the `git2.h` header will include all the other libgit2 headers
43+
* that you need. It should be the only thing you need to include in order
44+
* to compile properly and get all the libgit2 API.
45+
*/
4246
#include <git2.h>
4347
#include <stdio.h>
4448
#include <string.h>
@@ -55,9 +59,11 @@ static void index_walking(git_repository *repo);
5559
static void reference_listing(git_repository *repo);
5660
static void config_files(const char *repo_path);
5761

58-
// Almost all libgit2 functions return 0 on success or negative on error.
59-
// This is not production quality error checking, but should be sufficient
60-
// as an example.
62+
/**
63+
* Almost all libgit2 functions return 0 on success or negative on error.
64+
* This is not production quality error checking, but should be sufficient
65+
* as an example.
66+
*/
6167
static void check_error(int error_code, const char *action)
6268
{
6369
const git_error *error = giterr_last();
@@ -74,19 +80,23 @@ int main (int argc, char** argv)
7480
{
7581
git_oid oid;
7682

77-
// Initialize the library, this will set up any global state which libgit2 needs
78-
// including threading and crypto
83+
/**
84+
* Initialize the library, this will set up any global state which libgit2 needs
85+
* including threading and crypto
86+
*/
7987
git_libgit2_init();
8088

81-
// ### Opening the Repository
82-
83-
// There are a couple of methods for opening a repository, this being the
84-
// simplest. There are also [methods][me] for specifying the index file
85-
// and work tree locations, here we assume they are in the normal places.
86-
//
87-
// (Try running this program against tests/resources/testrepo.git.)
88-
//
89-
// [me]: http://libgit2.github.com/libgit2/#HEAD/group/repository
89+
/**
90+
* ### Opening the Repository
91+
*
92+
* There are a couple of methods for opening a repository, this being the
93+
* simplest. There are also [methods][me] for specifying the index file
94+
* and work tree locations, here we assume they are in the normal places.
95+
*
96+
* (Try running this program against tests/resources/testrepo.git.)
97+
*
98+
* [me]: http://libgit2.github.com/libgit2/#HEAD/group/repository
99+
*/
90100
int error;
91101
const char *repo_path = (argc > 1) ? argv[1] : "/opt/libgit2-test/.git";
92102
git_repository *repo;
@@ -106,7 +116,9 @@ int main (int argc, char** argv)
106116
reference_listing(repo);
107117
config_files(repo_path);
108118

109-
// Finally, when you're done with the repository, you can free it as well.
119+
/**
120+
* Finally, when you're done with the repository, you can free it as well.
121+
*/
110122
git_repository_free(repo);
111123

112124
return 0;

0 commit comments

Comments
 (0)