Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
less bprintf (some were completely useless)
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 9 Aug 2017 09:17:56 +0000 (11:17 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 9 Aug 2017 09:17:56 +0000 (11:17 +0200)
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_task.cpp
src/kernel/routing/ClusterZone.cpp

index 184e259..000d1d4 100644 (file)
@@ -101,7 +101,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv * env, jcl
   msg_process_t process = MSG_process_from_PID(pid);
 
   if (not process) {
-    jxbt_throw_process_not_found(env, bprintf("PID = %d",static_cast<int>(pid)));
+    jxbt_throw_process_not_found(env, std::string("PID = ") + std::to_string(static_cast<int>(pid)));
     return nullptr;
   }
 
@@ -156,7 +156,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_suspend(JNIEnv * env, jobjec
   /* try to suspend the process */
   msg_error_t rv = MSG_process_suspend(process);
 
-  jxbt_check_res("MSG_process_suspend()", rv, MSG_OK, bprintf("unexpected error , please report this bug"));
+  jxbt_check_res("MSG_process_suspend()", rv, MSG_OK, "unexpected error , please report this bug");
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume(JNIEnv * env, jobject jprocess)
@@ -170,7 +170,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume(JNIEnv * env, jobject
 
   /* try to resume the process */
   msg_error_t res = MSG_process_resume(process);
-  jxbt_check_res("MSG_process_resume()", res, MSG_OK, bprintf("unexpected error , please report this bug"));
+  jxbt_check_res("MSG_process_resume()", res, MSG_OK, "unexpected error , please report this bug");
 }
 
 JNIEXPORT void
index 47dfe47..eb5ca2d 100644 (file)
@@ -112,7 +112,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_cancel(JNIEnv * env, jobject jt
 
   msg_error_t rv = MSG_task_cancel(ptask);
 
-  jxbt_check_res("MSG_task_cancel()", rv, MSG_OK, bprintf("unexpected error , please report this bug"));
+  jxbt_check_res("MSG_task_cancel()", rv, MSG_OK, "unexpected error , please report this bug");
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_execute(JNIEnv * env, jobject jtask)
index 5017225..9467b8d 100644 (file)
@@ -121,7 +121,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
 
 void ClusterZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int /*rank*/, int position)
 {
-  char* link_id = bprintf("%s_link_%d", cluster->id, id);
+  std::string link_id = std::string(cluster->id) + "_link_" + std::to_string(id);
 
   LinkCreationArgs link;
   link.id        = link_id;
@@ -135,13 +135,12 @@ void ClusterZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id
   if (link.policy == SURF_LINK_FULLDUPLEX) {
     std::string tmp_link = std::string(link_id) + "_UP";
     linkUp         = surf::LinkImpl::byName(tmp_link);
-    tmp_link = bprintf("%s_DOWN", link_id);
+    tmp_link             = std::string(link_id) + "_DOWN";
     linkDown = surf::LinkImpl::byName(tmp_link);
   } else {
     linkUp   = surf::LinkImpl::byName(link_id);
     linkDown = linkUp;
   }
-  xbt_free(link_id);
   privateLinks_.insert({position, {linkUp, linkDown}});
 }
 }