Commit 03b4faf6 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

remove gib_utils, the same functionality is provided by utils already

parent f0fd0413
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gib_imlib.h"
#include "gib_list.h"
#include "gib_style.h"
#include "gib_utils.h"

#include "structs.h"
#include "menu.h"
+4 −3
Original line number Diff line number Diff line
@@ -24,11 +24,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "gib_hash.h"
#include "gib_utils.h"
#include "utils.h"
#include "debug.h"

gib_hash_node *gib_hash_node_new(char *key, void *data)
{
	gib_hash_node *node = malloc(sizeof(gib_hash_node));
	gib_hash_node *node = emalloc(sizeof(gib_hash_node));
	node->key = strdup(key);
	GIB_LIST(node)->data = data;
	GIB_LIST(node)->next = NULL;
@@ -53,7 +54,7 @@ void gib_hash_node_free_and_data(gib_hash_node *node)

gib_hash *gib_hash_new()
{
	gib_hash *hash = malloc(sizeof(gib_hash));
	gib_hash *hash = emalloc(sizeof(gib_hash));
	hash->base = gib_hash_node_new("__gib_hash_new",NULL);
	return hash;
}
+21 −20
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "gib_imlib.h"
#include "gib_utils.h"
#include "utils.h"
#include "debug.h"

int
gib_imlib_load_image(Imlib_Image * im, char *filename)
@@ -41,47 +42,47 @@ gib_imlib_load_image(Imlib_Image * im, char *filename)
      switch (err)
      {
        case IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST:
           gib_weprintf("%s - File does not exist", filename);
           weprintf("%s - File does not exist", filename);
           break;
        case IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY:
           gib_weprintf("%s - Directory specified for image filename", filename);
           weprintf("%s - Directory specified for image filename", filename);
           break;
        case IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ:
           gib_weprintf("%s - No read access to directory", filename);
           weprintf("%s - No read access to directory", filename);
           break;
        case IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT:
           gib_weprintf("%s - No Imlib2 loader for that file format", filename);
           weprintf("%s - No Imlib2 loader for that file format", filename);
           break;
        case IMLIB_LOAD_ERROR_PATH_TOO_LONG:
           gib_weprintf("%s - Path specified is too long", filename);
           weprintf("%s - Path specified is too long", filename);
           break;
        case IMLIB_LOAD_ERROR_PATH_COMPONENT_NON_EXISTANT:
           gib_weprintf("%s - Path component does not exist", filename);
           weprintf("%s - Path component does not exist", filename);
           break;
        case IMLIB_LOAD_ERROR_PATH_COMPONENT_NOT_DIRECTORY:
           gib_weprintf("%s - Path component is not a directory", filename);
           weprintf("%s - Path component is not a directory", filename);
           break;
        case IMLIB_LOAD_ERROR_PATH_POINTS_OUTSIDE_ADDRESS_SPACE:
           gib_weprintf("%s - Path points outside address space", filename);
           weprintf("%s - Path points outside address space", filename);
           break;
        case IMLIB_LOAD_ERROR_TOO_MANY_SYMBOLIC_LINKS:
           gib_weprintf("%s - Too many levels of symbolic links", filename);
           weprintf("%s - Too many levels of symbolic links", filename);
           break;
        case IMLIB_LOAD_ERROR_OUT_OF_MEMORY:
           gib_eprintf("While loading %s - Out of memory", filename);
           eprintf("While loading %s - Out of memory", filename);
           break;
        case IMLIB_LOAD_ERROR_OUT_OF_FILE_DESCRIPTORS:
           gib_eprintf("While loading %s - Out of file descriptors", filename);
           eprintf("While loading %s - Out of file descriptors", filename);
           break;
        case IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_WRITE:
           gib_weprintf("%s - Cannot write to directory", filename);
           weprintf("%s - Cannot write to directory", filename);
           break;
        case IMLIB_LOAD_ERROR_OUT_OF_DISK_SPACE:
           gib_weprintf("%s - Cannot write - out of disk space", filename);
           weprintf("%s - Cannot write - out of disk space", filename);
           break;
        case IMLIB_LOAD_ERROR_UNKNOWN:
        default:
           gib_weprintf
           weprintf
              ("While loading %s - Unknown error. Attempting to continue",
               filename);
           break;
@@ -628,7 +629,7 @@ void gib_imlib_parse_color(char *col, int *r, int *g, int *b, int *a)
      }
      else
      {
         gib_weprintf("unable to parse color %s\n", col);
         weprintf("unable to parse color %s\n", col);
         return;
      }
   }
@@ -638,7 +639,7 @@ void gib_imlib_parse_color(char *col, int *r, int *g, int *b, int *a)
      ll = gib_string_split(col, ",");
      if (!ll)
      {
         gib_weprintf("unable to parse color %s\n", col);
         weprintf("unable to parse color %s\n", col);
         return;
      }
      len = gib_list_length(ll);
@@ -658,7 +659,7 @@ void gib_imlib_parse_color(char *col, int *r, int *g, int *b, int *a)
      }
      else
      {
         gib_weprintf("unable to parse color %s\n", col);
         weprintf("unable to parse color %s\n", col);
         return;
      }
   }
@@ -695,10 +696,10 @@ gib_imlib_load_font(char *name)

   if ((fn = imlib_load_font(name)))
      return fn;
   gib_weprintf("couldn't load font %s, attempting to fall back to fixed.", name);
   weprintf("couldn't load font %s, attempting to fall back to fixed.", name);
   if ((fn = imlib_load_font("fixed")))
      return fn;
   gib_weprintf("failed to even load fixed! Attempting to find any font.");
   weprintf("failed to even load fixed! Attempting to find any font.");
   return imlib_load_font("*");
}

+5 −55
Original line number Diff line number Diff line
@@ -25,14 +25,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#include <time.h>
#include "gib_list.h"
#include "gib_utils.h"
#include "utils.h"
#include "debug.h"

gib_list *
gib_list_new(void)
{
   gib_list *l;

   l = (gib_list *) malloc(sizeof(gib_list));
   l = (gib_list *) emalloc(sizeof(gib_list));
   l->data = NULL;
   l->next = NULL;
   l->prev = NULL;
@@ -354,7 +355,7 @@ gib_list_randomize(gib_list * list)
   len = gib_list_length(list);
   if (len <= 1)
      return (list);
   farray = (gib_list **) malloc(sizeof(gib_list *) * len);
   farray = (gib_list **) emalloc(sizeof(gib_list *) * len);
   for (f = list, i = 0; f; f = f->next, i++)
   {
      farray[i] = f;
@@ -556,7 +557,7 @@ gib_string_split(const char *string, const char *delimiter)
         char *new_string;

         len = s - string;
         new_string = malloc(sizeof(char) * (len + 1));
         new_string = emalloc(sizeof(char) * (len + 1));

         strncpy(new_string, string, len);
         new_string[len] = 0;
@@ -577,54 +578,3 @@ gib_string_split(const char *string, const char *delimiter)

   return string_list;
}

#if 0
char *
gib_strjoin(const char *separator, ...)
{
      char *string, *s;
   va_list args;
   int len;
   int separator_len;

   if (separator == NULL)
      separator = "";

   separator_len = strlen(separator);
   va_start(args, separator);
   s = va_arg(args, char *);

   if (s)
   {
      len = strlen(s);
      s = va_arg(args, char *);

      while (s)
      {
         len += separator_len + strlen(s);
         s = va_arg(args, char *);
      }
      va_end(args);
      string = malloc(sizeof(char) * (len + 1));

      *string = 0;
      va_start(args, separator);
      s = va_arg(args, char *);

      strcat(string, s);
      s = va_arg(args, char *);

      while (s)
      {
         strcat(string, separator);
         strcat(string, s);
         s = va_arg(args, char *);
      }
   }
   else
      string = strdup("");
   va_end(args);

   return string;
}
#endif
+4 −3
Original line number Diff line number Diff line
@@ -24,14 +24,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "gib_style.h"
#include "gib_utils.h"
#include "utils.h"
#include "debug.h"

gib_style *
gib_style_new(char *name)
{
   gib_style *s = NULL;

   s = malloc(sizeof(gib_style));
   s = emalloc(sizeof(gib_style));

   memset(s, 0, sizeof(gib_style));
   if (name)
@@ -69,7 +70,7 @@ gib_style_bit_new(int x_offset, int y_offset, int r, int g, int b, int a)
{
   gib_style_bit *sb;

   sb = malloc(sizeof(gib_style_bit));
   sb = emalloc(sizeof(gib_style_bit));
   memset(sb, 0, sizeof(gib_style_bit));

   sb->x_offset = x_offset;
Loading