view osdep/setenv.c @ 25520:1a97bd3ad684

Remove unused variables, fixes the warnings: vo_bl.c: In function 'draw_slice': vo_bl.c:329: warning: unused variable 'src2' vo_bl.c:328: warning: unused variable 'src1' vo_bl.c:325: warning: unused variable 'j'
author diego
date Sun, 30 Dec 2007 11:05:53 +0000
parents 936209c39ed1
children 5cfef41a1771
line wrap: on
line source

/* setenv implementation for systems lacking it. */

#include "config.h"

#include <stdlib.h>
#include <string.h>
#ifndef MP_DEBUG
  #define NDEBUG
#endif
#include <assert.h>

int setenv(const char *name, const char *val, int overwrite)
{
  int len  = strlen(name) + strlen(val) + 2;
  char *env = malloc(len);
  if (!env) { return -1; }

  assert(overwrite != 0);

  strcpy(env, name);
  strcat(env, "=");
  strcat(env, val);
  putenv(env);

  return 0;
}