@@ -439,8 +439,7 @@ void MineManager::migrate() {
439439 Program p;
440440 p = parser.parse (f);
441441 f.close ();
442- const auto submitted_by =
443- Comments::getCommentField (p, Comments::PREFIX_SUBMITTED_BY);
442+ const auto submitter = Comments::getSubmitter (p);
444443 ProgramUtil::removeOps (p, Operation::Type::NOP);
445444 for (size_t i = 0 ; i < 3 && i < p.ops .size (); i++) {
446445 auto &op = p.ops [i];
@@ -453,7 +452,7 @@ void MineManager::migrate() {
453452 auto result = evaluator.check (p, terms, -1 , s.id );
454453 if (result.first != status_t ::ERROR) {
455454 Log::get ().info (" Migrating " + s.id .string ());
456- dumpProgram (s.id , p, path, submitted_by );
455+ dumpProgram (s.id , p, path, submitter );
457456 }
458457 break ;
459458 }
@@ -549,8 +548,7 @@ void MineManager::updateDependentOffset(UID id, UID used_id, int64_t delta) {
549548 } catch (const std::exception &) {
550549 return ; // ignore this dependent program
551550 }
552- auto submitted_by =
553- Comments::getCommentField (p, Comments::PREFIX_SUBMITTED_BY);
551+ auto submitter = Comments::getSubmitter (p);
554552 bool updated = false ;
555553 for (size_t i = 0 ; i < p.ops .size (); i++) {
556554 const auto &op = p.ops [i];
@@ -566,7 +564,7 @@ void MineManager::updateDependentOffset(UID id, UID used_id, int64_t delta) {
566564 }
567565 if (updated) {
568566 optimizer.optimize (p);
569- dumpProgram (id, p, path, submitted_by );
567+ dumpProgram (id, p, path, submitter );
570568 }
571569}
572570
@@ -583,7 +581,7 @@ void MineManager::updateAllDependentOffset(UID id, int64_t delta) {
583581}
584582
585583void MineManager::dumpProgram (UID id, Program &p, const std::string &file,
586- const std::string &submitted_by ) const {
584+ const std::string &submitter ) const {
587585 ProgramUtil::removeOps (p, Operation::Type::NOP);
588586 Comments::removeComments (p);
589587 addSeqComments (p);
@@ -593,8 +591,8 @@ void MineManager::dumpProgram(UID id, Program &p, const std::string &file,
593591 Operation nop (Operation::Type::NOP);
594592 nop.comment = seq.string ();
595593 tmp.ops .push_back (nop);
596- if (!submitted_by .empty ()) {
597- nop.comment = Comments::PREFIX_SUBMITTED_BY + " " + submitted_by ;
594+ if (!submitter .empty ()) {
595+ nop.comment = Comments::PREFIX_SUBMITTED_BY + " " + submitter ;
598596 tmp.ops .push_back (nop);
599597 }
600598 static constexpr size_t MAX_PRINT_TERMS = 80 ; // magic number
@@ -624,7 +622,7 @@ void MineManager::dumpProgram(UID id, Program &p, const std::string &file,
624622
625623void MineManager::alert (Program p, UID id, const std::string &prefix,
626624 const std::string &color,
627- const std::string &submitted_by ) const {
625+ const std::string &submitter ) const {
628626 const auto &seq = sequences.get (id);
629627 std::string msg, full;
630628 msg = prefix + " program for " + seq.string ();
@@ -637,8 +635,8 @@ void MineManager::alert(Program p, UID id, const std::string &prefix,
637635 if (generator.generate (p, id.number (), formula, false )) {
638636 full += " . " + Comments::PREFIX_FORMULA + " " + formula.toString ();
639637 }
640- if (!submitted_by .empty ()) {
641- std::string sub = Comments::PREFIX_SUBMITTED_BY + " " + submitted_by ;
638+ if (!submitter .empty ()) {
639+ std::string sub = Comments::PREFIX_SUBMITTED_BY + " " + submitter ;
642640 msg += " " + sub;
643641 full += " . " + sub;
644642 }
@@ -689,8 +687,7 @@ update_program_result_t MineManager::updateProgram(
689687 }
690688
691689 // get metadata from comments
692- const std::string submitted_by =
693- Comments::getCommentField (p, Comments::PREFIX_SUBMITTED_BY);
690+ const std::string submitter = Comments::getSubmitter (p);
694691 const std::string change_type =
695692 Comments::getCommentField (p, Comments::PREFIX_CHANGE_TYPE);
696693 const std::string previous_hash_str =
@@ -749,7 +746,7 @@ update_program_result_t MineManager::updateProgram(
749746 const std::string target_file = ProgramUtil::getProgramPath (id, !is_server);
750747 auto delta = updateProgramOffset (id, result.program );
751748 optimizer.optimize (result.program );
752- dumpProgram (id, result.program , target_file, submitted_by );
749+ dumpProgram (id, result.program , target_file, submitter );
753750 if (is_server) {
754751 updateAllDependentOffset (id, delta);
755752 }
@@ -766,7 +763,7 @@ update_program_result_t MineManager::updateProgram(
766763
767764 // send alert
768765 std::string color = is_new ? " good" : " warning" ;
769- alert (result.program , id, checked.status , color, submitted_by );
766+ alert (result.program , id, checked.status , color, submitter );
770767
771768 return result;
772769}
@@ -791,13 +788,12 @@ bool MineManager::maintainProgram(UID id, bool eval) {
791788
792789 // try to load the program
793790 Program program;
794- std::string submitted_by ;
791+ std::string submitter ;
795792 if (is_okay) {
796793 Log::get ().info (" Checking program for " + s.string ());
797794 try {
798795 program = parser.parse (program_file);
799- submitted_by =
800- Comments::getCommentField (program, Comments::PREFIX_SUBMITTED_BY);
796+ submitter = Comments::getSubmitter (program);
801797 } catch (const std::exception &) {
802798 is_okay = false ;
803799 }
@@ -847,7 +843,7 @@ bool MineManager::maintainProgram(UID id, bool eval) {
847843 } else {
848844 optimizer.optimize (updated);
849845 }
850- dumpProgram (s.id , updated, file_name, submitted_by );
846+ dumpProgram (s.id , updated, file_name, submitter );
851847 updateAllDependentOffset (s.id , delta);
852848 } catch (const std::exception &e) {
853849 is_okay = false ;
0 commit comments