/*
* Simple semaphore implementation, P() and V().
*
- * Copyright (C) 2011 Simon Ruderich
+ * Copyright (C) 2011-2012 Simon Ruderich
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "sem.h"
+
#include <stdlib.h>
#include <pthread.h>
-#include "sem.h"
-
struct SEM {
pthread_mutex_t mutex;
};
SEM *sem_init(int init_value) {
- SEM *sem = (SEM *)malloc(sizeof(SEM));
+ SEM *sem = malloc(sizeof(*sem));
if (NULL == sem) {
return NULL;
}