Skip to content

Commit

Permalink
comments: change three-line comments to one-line comments
Browse files Browse the repository at this point in the history
  • Loading branch information
arogge committed Apr 23, 2021
1 parent 7cd5413 commit e9a60dd
Show file tree
Hide file tree
Showing 67 changed files with 1,533 additions and 4,599 deletions.
20 changes: 5 additions & 15 deletions core/src/cats/postgresql.cc
Expand Up @@ -771,9 +771,7 @@ uint64_t BareosDbPostgresql::SqlInsertAutokeyRecord(const char* query,
char getkeyval_query[NAMEDATALEN + 50];
PGresult* pg_result;

/*
* First execute the insert query and then retrieve the currval.
*/
// First execute the insert query and then retrieve the currval.
if (!SqlQueryWithoutHandler(query)) { return 0; }

num_rows_ = SqlAffectedRows();
Expand Down Expand Up @@ -864,9 +862,7 @@ SQL_FIELD* BareosDbPostgresql::SqlFetchField(void)
fields_[i].type = PQftype(result_, i);
fields_[i].flags = 0;

/*
* For a given column, find the max length.
*/
// For a given column, find the max length.
max_length = 0;
for (j = 0; j < num_rows_; j++) {
if (PQgetisnull(result_, j, i)) {
Expand All @@ -887,9 +883,7 @@ SQL_FIELD* BareosDbPostgresql::SqlFetchField(void)
}
}

/*
* Increment field number for the next time around
*/
// Increment field number for the next time around
return &fields_[field_number_++];
}

Expand All @@ -905,9 +899,7 @@ bool BareosDbPostgresql::SqlFieldIsNotNull(int field_type)

bool BareosDbPostgresql::SqlFieldIsNumeric(int field_type)
{
/*
* TEMP: the following is taken from select OID, typname from pg_type;
*/
// TEMP: the following is taken from select OID, typname from pg_type;
switch (field_type) {
case 20:
case 21:
Expand Down Expand Up @@ -962,9 +954,7 @@ BareosDb* db_init_database(JobControlRecord* jcr,
}
P(mutex); /* lock DB queue */

/*
* Look to see if DB already open
*/
// Look to see if DB already open
if (db_list && !mult_db_connections && !need_private) {
foreach_dlist (mdb, db_list) {
if (mdb->IsPrivate()) { continue; }
Expand Down
40 changes: 10 additions & 30 deletions core/src/cats/sql.cc
Expand Up @@ -683,9 +683,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
field = SqlFetchField();
if (!field) { break; }

/*
* See if this is a hidden column.
*/
// See if this is a hidden column.
if (send->IsHiddenColumn(i)) {
Dmsg1(800, "ListResult field %d is hidden\n", i);
continue;
Expand Down Expand Up @@ -725,9 +723,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
Dmsg1(800, "ListResult starts second loop looking at %d fields\n",
num_fields);
while ((row = SqlFetchRow()) != NULL) {
/*
* See if we should allow this under the current filtering.
*/
// See if we should allow this under the current filtering.
if (filters_enabled && !send->FilterData(row)) { continue; }

send->ObjectStart();
Expand All @@ -736,9 +732,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
field = SqlFetchField();
if (!field) { break; }

/*
* See if this is a hidden column.
*/
// See if this is a hidden column.
if (send->IsHiddenColumn(i)) {
Dmsg1(800, "ListResult field %d is hidden\n", i);
continue;
Expand Down Expand Up @@ -767,9 +761,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
field = SqlFetchField();
if (!field) { break; }

/*
* See if this is a hidden column.
*/
// See if this is a hidden column.
if (send->IsHiddenColumn(i)) {
Dmsg1(800, "ListResult field %d is hidden\n", i);
continue;
Expand All @@ -784,9 +776,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
Dmsg1(800, "ListResult starts third loop looking at %d fields\n",
num_fields);
while ((row = SqlFetchRow()) != NULL) {
/*
* See if we should allow this under the current filtering.
*/
// See if we should allow this under the current filtering.
if (filters_enabled && !send->FilterData(row)) { continue; }

send->ObjectStart();
Expand All @@ -796,9 +786,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
field = SqlFetchField();
if (!field) { break; }

/*
* See if this is a hidden column.
*/
// See if this is a hidden column.
if (send->IsHiddenColumn(i)) {
Dmsg1(800, "ListResult field %d is hidden\n", i);
continue;
Expand All @@ -815,9 +803,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
}
if (i == num_fields - 1) { value.strcat("\n"); }

/*
* Use value format string to send preformated value
*/
// Use value format string to send preformated value
send->ObjectKeyValue(field->name, row[i], value.c_str());
}
send->ObjectEnd();
Expand All @@ -827,9 +813,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
case VERT_LIST:
Dmsg1(800, "ListResult starts vertical list at %d fields\n", num_fields);
while ((row = SqlFetchRow()) != NULL) {
/*
* See if we should allow this under the current filtering.
*/
// See if we should allow this under the current filtering.
if (filters_enabled && !send->FilterData(row)) { continue; }

send->ObjectStart();
Expand All @@ -838,9 +822,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
field = SqlFetchField();
if (!field) { break; }

/*
* See if this is a hidden column.
*/
// See if this is a hidden column.
if (send->IsHiddenColumn(i)) {
Dmsg1(800, "ListResult field %d is hidden\n", i);
continue;
Expand All @@ -858,9 +840,7 @@ int BareosDb::ListResult(JobControlRecord* jcr,
value.bsprintf("%s\n", row[i]);
}

/*
* Use value format string to send preformated value
*/
// Use value format string to send preformated value
send->ObjectKeyValue(field->name, key.c_str(), row[i], value.c_str());
}
send->Decoration("\n");
Expand Down
20 changes: 5 additions & 15 deletions core/src/dird/backup.cc
Expand Up @@ -692,9 +692,7 @@ int WaitForJobTermination(JobControlRecord* jcr, int timeout)
// Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/JobErrors
WaitForStorageDaemonTermination(jcr);

/*
* Return values from FD
*/
// Return values from FD
if (fd_ok) {
jcr->JobFiles = JobFiles;
jcr->JobErrors += JobErrors; /* Keep total errors */
Expand All @@ -711,9 +709,7 @@ int WaitForJobTermination(JobControlRecord* jcr, int timeout)
// jcr->impl_->FDJobStatus,
// jcr->JobStatus, jcr->impl_->SDJobStatus);

/*
* Return the first error status we find Dir, FD, or SD
*/
// Return the first error status we find Dir, FD, or SD
if (!fd_ok || IsBnetError(fd)) { /* if fd not set, that use !fd_ok */
jcr->impl->FDJobStatus = JS_ErrorTerminated;
}
Expand All @@ -724,9 +720,7 @@ int WaitForJobTermination(JobControlRecord* jcr, int timeout)
return jcr->impl->SDJobStatus;
}

/*
* Release resources allocated during backup.
*/
// Release resources allocated during backup.
void NativeBackupCleanup(JobControlRecord* jcr, int TermCode)
{
const char* TermMsg;
Expand Down Expand Up @@ -802,9 +796,7 @@ void NativeBackupCleanup(JobControlRecord* jcr, int TermCode)

void UpdateBootstrapFile(JobControlRecord* jcr)
{
/*
* Now update the bootstrap file if any
*/
// Now update the bootstrap file if any
if (jcr->IsTerminatedOk() && jcr->impl->jr.JobBytes
&& jcr->impl->res.job->WriteBootstrap) {
FILE* fd;
Expand Down Expand Up @@ -926,9 +918,7 @@ void GenerateBackupSummary(JobControlRecord *jcr, ClientDbRecord *cr, int msg_ty
}

if (jcr->VolumeName[0]) {
/*
* Find last volume name. Multiple vols are separated by |
*/
// Find last volume name. Multiple vols are separated by |
char *p = strrchr(jcr->VolumeName, '|');
if (p) {
p++; /* skip | */
Expand Down
12 changes: 3 additions & 9 deletions core/src/dird/catreq.cc
Expand Up @@ -602,9 +602,7 @@ static void UpdateAttribute(JobControlRecord* jcr,
Dmsg2(400, "Cached attr with digest. Stream=%d fname=%s\n",
ar->Stream, ar->fname);

/*
* Update BaseFile table
*/
// Update BaseFile table
if (!jcr->db->CreateAttributesRecord(jcr, ar)) {
Jmsg1(jcr, M_FATAL, 0, _("attribute create error. %s"),
jcr->db->strerror());
Expand All @@ -623,9 +621,7 @@ static void UpdateAttribute(JobControlRecord* jcr,
}
}

/**
* Update File Attributes in the catalog with data sent by the Storage daemon.
*/
// Update File Attributes in the catalog with data sent by the Storage daemon.
void CatalogUpdate(JobControlRecord* jcr, BareosSocket* bs)
{
if (!jcr->impl->res.pool->catalog_files) {
Expand Down Expand Up @@ -687,9 +683,7 @@ bool DespoolAttributesFromFile(JobControlRecord* jcr, const char* file)
message_length = ntohl(pktsiz);

if (message_length > 0) {
/*
* check for message_length + \0
*/
// check for message_length + \0
if ((message_length + 1) > (int32_t)SizeofPoolMemory(msg)) {
msg = ReallocPoolMemory(msg, message_length + 1);
}
Expand Down
36 changes: 9 additions & 27 deletions core/src/dird/dbcheck.cc
Expand Up @@ -787,9 +787,7 @@ static void repair_bad_filenames()
if (!db->SqlQuery(buf, GetNameHandler, name)) {
printf("%s\n", db->strerror());
}
/*
* Strip trailing slash(es)
*/
// Strip trailing slash(es)
for (len = strlen(name); len > 0 && IsPathSeparator(name[len - 1]);
len--) {}
if (len == 0) {
Expand Down Expand Up @@ -847,15 +845,11 @@ static void repair_bad_paths()
if (!db->SqlQuery(buf, GetNameHandler, name)) {
printf("%s\n", db->strerror());
}
/*
* Strip trailing blanks
*/
// Strip trailing blanks
for (len = strlen(name); len > 0 && name[len - 1] == ' '; len--) {
name[len - 1] = 0;
}
/*
* Add trailing slash
*/
// Add trailing slash
len = PmStrcat(name, "/");
db->EscapeString(NULL, esc_name, name, len);
Bsnprintf(buf, sizeof(buf), "UPDATE Path SET Path='%s' WHERE PathId=%s",
Expand Down Expand Up @@ -926,9 +920,7 @@ static void do_interactive_mode()
}
}

/**
* main
*/
// main
int main(int argc, char* argv[])
{
int ch;
Expand Down Expand Up @@ -1044,9 +1036,7 @@ int main(int argc, char* argv[])
DbSetBackendDirs(me->backend_directories);
#endif

/*
* Print catalog information and exit (-B)
*/
// Print catalog information and exit (-B)
if (print_catalog) {
PrintCatalogDetails(catalog, me->working_directory);
exit(0);
Expand All @@ -1066,9 +1056,7 @@ int main(int argc, char* argv[])
usage();
}

/*
* This is needed by SQLite to find the db
*/
// This is needed by SQLite to find the db
working_directory = argv[0];
db_name = "bareos";
user = db_name;
Expand Down Expand Up @@ -1112,19 +1100,15 @@ int main(int argc, char* argv[])
#endif
}

/*
* Open database
*/
// Open database
db = db_init_database(NULL, db_driver, db_name, user, password, dbhost,
dbport, NULL, false, false, false, false);
if (!db->OpenDatabase(NULL)) {
Emsg1(M_FATAL, 0, "%s", db->strerror());
return 1;
}

/*
* Drop temporary index idx_tmp_name if it already exists
*/
// Drop temporary index idx_tmp_name if it already exists
DropTmpIdx("idxPIchk", "File");

if (batch) {
Expand All @@ -1133,9 +1117,7 @@ int main(int argc, char* argv[])
do_interactive_mode();
}

/*
* Drop temporary index idx_tmp_name
*/
// Drop temporary index idx_tmp_name
DropTmpIdx("idxPIchk", "File");

db->CloseDatabase(NULL);
Expand Down

0 comments on commit e9a60dd

Please sign in to comment.