From patchwork Thu Jul 1 10:47:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 57532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B5E7E1007D6 for ; Thu, 1 Jul 2010 20:53:47 +1000 (EST) Received: from localhost ([127.0.0.1]:45916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUHOq-0004KS-0z for incoming@patchwork.ozlabs.org; Thu, 01 Jul 2010 06:53:44 -0400 Received: from [140.186.70.92] (port=46118 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUHOG-0004KC-Kd for qemu-devel@nongnu.org; Thu, 01 Jul 2010 06:53:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OUHOF-0004ye-3w for qemu-devel@nongnu.org; Thu, 01 Jul 2010 06:53:08 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:59011) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUHOE-0004xZ-PN for qemu-devel@nongnu.org; Thu, 01 Jul 2010 06:53:07 -0400 Received: from flocke.weilnetz.de (p54ADFF40.dip.t-dialin.net [84.173.255.64]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0LbvAu-1OtgVj1xW0-00jfmm; Thu, 01 Jul 2010 12:47:55 +0200 Received: from stefan by flocke.weilnetz.de with local (Exim 4.72) (envelope-from ) id 1OUHJC-0000Cc-3h; Thu, 01 Jul 2010 12:47:54 +0200 From: Stefan Weil To: QEMU Developers Date: Thu, 1 Jul 2010 12:47:49 +0200 Message-Id: <1277981269-751-1-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.7.1 X-Provags-ID: V01U2FsdGVkX18tQ3zAL9RYBmeg2GQpspWdXhQm3+Ca2k5vqwK Y3vPTxRdZtHZWAszRHZvOSkCoYZjIFAhUEb2hL3pj80+aw8z/I IErbUtYsQ9VjlTzJbXcY6g+jJ8SnYJsqS8mZdDxvKZrUdGE6Ll yXA== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH] win32: Add missing function setenv X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Mingw32 does not provide a declaration and implementation of function setenv (which is used in sdl.c), so this patch adds both. Signed-off-by: Stefan Weil --- os-win32.c | 15 +++++++++++++++ osdep.h | 2 ++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/os-win32.c b/os-win32.c index d98fd77..dd46bf4 100644 --- a/os-win32.c +++ b/os-win32.c @@ -34,6 +34,21 @@ #include "qemu-options.h" /***********************************************************/ +/* Functions missing in mingw */ + +int setenv(const char *name, const char *value, int overwrite) +{ + int result = 0; + if (overwrite || !getenv(name)) { + size_t length = strlen(name) + strlen(value) + 2; + char *string = qemu_malloc(length); + snprintf(string, length, "%s=%s", name, value); + result = putenv(string); + } + return result; +} + +/***********************************************************/ /* Polling handling */ typedef struct PollingEntry { diff --git a/osdep.h b/osdep.h index 75b5816..1cdc7e2 100644 --- a/osdep.h +++ b/osdep.h @@ -95,6 +95,8 @@ int qemu_create_pidfile(const char *filename); #ifdef _WIN32 int ffs(int i); +int setenv(const char *name, const char *value, int overwrite); + typedef struct { long tv_sec; long tv_usec;