fixed comment
[rocksndiamonds.git] / src / libgame / misc.c
index 6101cbaec3ea68a64dcc37d051ca06bbfeb55061..264b7f8d9af49b2f9e410f0f4a0e42b62cd9fe71 100644 (file)
@@ -620,12 +620,12 @@ static unsigned int mainCounter(int mode)
   return current_ms - base_ms;
 }
 
-void InitCounter()             // set counter back to zero
+void InitCounter(void)         // set counter back to zero
 {
   mainCounter(INIT_COUNTER);
 }
 
-unsigned int Counter() // get milliseconds since last call of InitCounter()
+unsigned int Counter(void)     // get milliseconds since last call of InitCounter()
 {
   return mainCounter(READ_COUNTER);
 }
@@ -1084,6 +1084,24 @@ char *getBasePath(char *filename)
 }
 
 
+// ----------------------------------------------------------------------------
+// various memory functions
+// ----------------------------------------------------------------------------
+
+void *getMemCopy(const void *m, size_t size)
+{
+  void *m_copy;
+
+  if (m == NULL)
+    return NULL;
+
+  m_copy = checked_malloc(size);
+  memcpy(m_copy, m, size);
+
+  return m_copy;
+}
+
+
 // ----------------------------------------------------------------------------
 // various string functions
 // ----------------------------------------------------------------------------
@@ -1220,6 +1238,18 @@ char *getStringCopyNStatic(const char *s, int n)
   return s_copy;
 }
 
+char *getStringToUpper(const char *s)
+{
+  char *s_copy = checked_malloc(strlen(s) + 1);
+  char *s_ptr = s_copy;
+
+  while (*s)
+    *s_ptr++ = toupper(*s++);
+  *s_ptr = '\0';
+
+  return s_copy;
+}
+
 char *getStringToLower(const char *s)
 {
   char *s_copy = checked_malloc(strlen(s) + 1);