commit 48d5bb36bf1cb0c2d9dee760272d99402362f4ba
parent edbf7df6b153c9faeeb31be589b823672bafbea1
Author: Chris Bracken <chris@bracken.jp>
Date: Fri, 10 May 2024 20:45:41 +0900
html: Use consistent repowriter naming
Previously, html was using html_repo_writer_* prefixes whereas gopher
was using gopher_repowriter_* prefixes. This makes both consistent with
the repowriter_* prefixes in writer/repo_writer.h.
Diffstat:
3 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/writer/html/repo_writer.c b/writer/html/repo_writer.c
@@ -27,7 +27,7 @@ struct HtmlRepoWriter {
Files* files_;
};
-HtmlRepoWriter* html_repo_writer_create(const RepoInfo* repo) {
+HtmlRepoWriter* html_repowriter_create(const RepoInfo* repo) {
HtmlRepoWriter* writer = ecalloc(1, sizeof(HtmlRepoWriter));
writer->repo_ = repo;
writer->refs_ = refs_create(repo);
@@ -38,7 +38,7 @@ HtmlRepoWriter* html_repo_writer_create(const RepoInfo* repo) {
return writer;
}
-void html_repo_writer_free(HtmlRepoWriter* writer) {
+void html_repowriter_free(HtmlRepoWriter* writer) {
if (!writer) {
return;
}
@@ -55,23 +55,23 @@ void html_repo_writer_free(HtmlRepoWriter* writer) {
free(writer);
}
-void html_repo_writer_set_log_cachefile(void* writer, const char* cachefile) {
+void html_repowriter_set_log_cachefile(void* writer, const char* cachefile) {
HtmlRepoWriter* html_writer = (HtmlRepoWriter*)writer;
log_set_cachefile(html_writer->log_, cachefile);
}
-void html_repo_writer_set_log_commit_limit(void* writer, size_t count) {
+void html_repowriter_set_log_commit_limit(void* writer, size_t count) {
HtmlRepoWriter* html_writer = (HtmlRepoWriter*)writer;
log_set_commit_limit(html_writer->log_, count);
}
-void html_repo_writer_set_baseurl(void* writer, const char* baseurl) {
+void html_repowriter_set_baseurl(void* writer, const char* baseurl) {
HtmlRepoWriter* html_writer = (HtmlRepoWriter*)writer;
atom_set_baseurl(html_writer->atom_, baseurl);
atom_set_baseurl(html_writer->tags_, baseurl);
}
-void html_repo_writer_begin(void* writer) {
+void html_repowriter_begin(void* writer) {
HtmlRepoWriter* html_writer = (HtmlRepoWriter*)writer;
mkdir("commit", S_IRWXU | S_IRWXG | S_IRWXO);
mkdir("file", S_IRWXU | S_IRWXG | S_IRWXO);
@@ -83,7 +83,7 @@ void html_repo_writer_begin(void* writer) {
files_begin(html_writer->files_);
}
-void html_repo_writer_add_commit(void* writer, const CommitInfo* ci) {
+void html_repowriter_add_commit(void* writer, const CommitInfo* ci) {
HtmlRepoWriter* html_writer = (HtmlRepoWriter*)writer;
char filename[PATH_MAX];
if (snprintf(filename, sizeof(filename), "%s.html", ci->oid) < 0) {
@@ -103,7 +103,7 @@ void html_repo_writer_add_commit(void* writer, const CommitInfo* ci) {
}
}
-void html_repo_writer_add_reference(void* writer, const ReferenceInfo* ri) {
+void html_repowriter_add_reference(void* writer, const ReferenceInfo* ri) {
HtmlRepoWriter* html_writer = (HtmlRepoWriter*)writer;
refs_add_ref(html_writer->refs_, ri);
if (ri->type == kReftypeTag) {
@@ -118,7 +118,7 @@ void html_repo_writer_add_reference(void* writer, const ReferenceInfo* ri) {
}
}
-void html_repo_writer_add_file(void* writer, const FileInfo* fi) {
+void html_repowriter_add_file(void* writer, const FileInfo* fi) {
HtmlRepoWriter* html_writer = (HtmlRepoWriter*)writer;
files_add_file(html_writer->files_, fi);
@@ -129,7 +129,7 @@ void html_repo_writer_add_file(void* writer, const FileInfo* fi) {
fileblob_free(blob);
}
-void html_repo_writer_end(void* writer) {
+void html_repowriter_end(void* writer) {
HtmlRepoWriter* html_writer = (HtmlRepoWriter*)writer;
refs_end(html_writer->refs_);
log_end(html_writer->log_);
diff --git a/writer/html/repo_writer.h b/writer/html/repo_writer.h
@@ -10,15 +10,15 @@
typedef struct HtmlRepoWriter HtmlRepoWriter;
-HtmlRepoWriter* html_repo_writer_create(const RepoInfo* repo);
-void html_repo_writer_free(HtmlRepoWriter* writer);
-void html_repo_writer_set_log_cachefile(void* writer, const char* cachefile);
-void html_repo_writer_set_log_commit_limit(void* writer, size_t count);
-void html_repo_writer_set_baseurl(void* writer, const char* baseurl);
-void html_repo_writer_begin(void* writer);
-void html_repo_writer_add_commit(void* writer, const CommitInfo* ci);
-void html_repo_writer_add_reference(void* writer, const ReferenceInfo* ri);
-void html_repo_writer_add_file(void* writer, const FileInfo* fi);
-void html_repo_writer_end(void* writer);
+HtmlRepoWriter* html_repowriter_create(const RepoInfo* repo);
+void html_repowriter_free(HtmlRepoWriter* writer);
+void html_repowriter_set_log_cachefile(void* writer, const char* cachefile);
+void html_repowriter_set_log_commit_limit(void* writer, size_t count);
+void html_repowriter_set_baseurl(void* writer, const char* baseurl);
+void html_repowriter_begin(void* writer);
+void html_repowriter_add_commit(void* writer, const CommitInfo* ci);
+void html_repowriter_add_reference(void* writer, const ReferenceInfo* ri);
+void html_repowriter_add_file(void* writer, const FileInfo* fi);
+void html_repowriter_end(void* writer);
#endif // GITOUT_WRITER_HTML_REPO_WRITER_H_
diff --git a/writer/repo_writer.c b/writer/repo_writer.c
@@ -101,17 +101,17 @@ void repowriter_end(RepoWriter* writer) {
RepoWriter* htmlrepowriter_create(RepoInfo* ri) {
RepoWriter* writer = ecalloc(1, sizeof(RepoWriter));
- HtmlRepoWriter* html_writer = html_repo_writer_create(ri);
+ HtmlRepoWriter* html_writer = html_repowriter_create(ri);
writer->type = kRepoWriterTypeHtml;
writer->impl = html_writer;
- writer->set_log_cachefile = html_repo_writer_set_log_cachefile;
- writer->set_log_commit_limit = html_repo_writer_set_log_commit_limit;
- writer->set_baseurl = html_repo_writer_set_baseurl;
- writer->begin = html_repo_writer_begin;
- writer->add_commit = html_repo_writer_add_commit;
- writer->add_reference = html_repo_writer_add_reference;
- writer->add_file = html_repo_writer_add_file;
- writer->end = html_repo_writer_end;
+ writer->set_log_cachefile = html_repowriter_set_log_cachefile;
+ writer->set_log_commit_limit = html_repowriter_set_log_commit_limit;
+ writer->set_baseurl = html_repowriter_set_baseurl;
+ writer->begin = html_repowriter_begin;
+ writer->add_commit = html_repowriter_add_commit;
+ writer->add_reference = html_repowriter_add_reference;
+ writer->add_file = html_repowriter_add_file;
+ writer->end = html_repowriter_end;
return writer;
}
@@ -119,7 +119,7 @@ void htmlrepowriter_free(RepoWriter* writer) {
if (!writer) {
return;
}
- html_repo_writer_free(writer->impl);
+ html_repowriter_free(writer->impl);
writer->impl = NULL;
free(writer);
}