ptr = malloc (strlen (str));
ptr = malloc (strlen (str) + 1);
upcase (const char *str){  char *ptr, *hptr;  ptr = malloc (strlen (str));  if (ptr == NULL)    {      f_print (stderr, "malloc failed\n");      exit (1);    }  hptr = ptr;  while (*str != '\0')    *ptr++ = toupper (*str++);  *ptr = '\0';  return hptr;}