Commits

dtrg  committed 1b601e1

s_create_string_constant() can now take a length parameter.

  • Participants
  • Parent commits 247c70d

Comments (0)

Files changed (2)

File src/com/cowlark/cowbel/backend/c/epilogue.h

 	s_argc = argc;
 	s_argv = S_ALLOC_GC(sizeof(s_string_t*) * s_argc);
 	for (i = 0; i < argc; i++)
-		s_argv[i] = s_create_string_constant(argv[i]);
+		s_argv[i] = s_create_string_constant(argv[i], 0);
 
 	cowbel_main();
 	return 0;

File src/com/cowlark/cowbel/backend/c/prologue.h

 	return outputbuffer;
 }
 
-static s_string_t* s_create_string_constant(const char* data)
+static s_string_t* s_create_string_constant(const char* data, int len)
 {
+	if (len == 0)
+		len = strlen(data);
+
 	s_string_t* s = S_ALLOC_GC(sizeof(s_string_t));
 	s->next = s->prev = NULL;
 	s->data = s->cdata = data;
-	s->seglength = s->totallength = strlen(data);
+	s->seglength = s->totallength = len;
 	return s;
 }