Exemple #1
0
gboolean
jb_test_compile_string (const char *str,
			const char *cflags,
			const char *cppflags)
{
  g_return_val_if_fail(str != NULL, FALSE);

  jb_write_file_or_exit("build/test.c", str);

  return jb_test_compile("build/test.c", cflags, cppflags);
}
void
jb_subst (const char *infile,
	  const char *outfile,
	  GHashTable *variables)
{
  char *contents;
  char *result;
  char *tmp_outfile;

  g_return_if_fail(infile != NULL);
  g_return_if_fail(outfile != NULL);
  g_return_if_fail(variables != NULL);

  contents = jb_read_file_or_exit(infile);
  result = subst_real(contents, variables);
  g_free(contents);

  tmp_outfile = g_strdup_printf("%s.tmp", outfile);
  jb_write_file_or_exit(tmp_outfile, result);
  g_free(result);

  jb_rename(tmp_outfile, outfile);
  g_free(tmp_outfile);
}