Skip to content

Commit

Permalink
Fix test_env()
Browse files Browse the repository at this point in the history
  • Loading branch information
nixw committed Mar 13, 2024
1 parent 28abd14 commit e8911f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ groth16_test_env(char *buffer, unsigned long buffer_maxsize)
return PROVER_ERROR_SHORT_BUFFER;
}

strncpy(buffer, stream.str().c_str(), buffer_maxsize);
const std::string str = stream.str();

strncpy(buffer, str.c_str(), buffer_maxsize);

return PROVER_OK;
}
18 changes: 4 additions & 14 deletions src/test_prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <cstring>
#include "fr.hpp"
#include "fq.hpp"
#include "prover.h"

#ifdef USE_OPENMP
#include <omp.h>
Expand Down Expand Up @@ -10934,21 +10935,10 @@ void print_results()

void test_env()
{
#ifdef USE_ASM
#if defined(ARCH_X86_64)
std::cout << "ASM: x86_64" << std::endl;
#elif defined(ARCH_ARM64)
std::cout << "ASM: arm64" << std::endl;
#endif
#else
std::cout << "ASM is disabled" << std::endl;
#endif
char buffer[4096];
groth16_test_env(buffer, 4096);

#ifdef USE_OPENMP
std::cout << "OpenMP max threads: " << omp_get_max_threads() << std::endl;
#else
std::cout << "OpenMP is disabled" << std::endl;
#endif
std::cout << buffer << std::endl;
}

int main()
Expand Down

0 comments on commit e8911f8

Please sign in to comment.