* [Qemu-devel] [PATCH] win32: Add missing function setenv
@ 2010-07-01 10:47 Stefan Weil
2010-07-01 11:50 ` Jes Sorensen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2010-07-01 10:47 UTC (permalink / raw)
To: QEMU Developers
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 <weil@mail.berlios.de>
---
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;
--
1.7.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] win32: Add missing function setenv
2010-07-01 10:47 [Qemu-devel] [PATCH] win32: Add missing function setenv Stefan Weil
@ 2010-07-01 11:50 ` Jes Sorensen
2010-07-01 13:22 ` Stefan Weil
0 siblings, 1 reply; 8+ messages in thread
From: Jes Sorensen @ 2010-07-01 11:50 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Developers
On 07/01/10 12:47, Stefan Weil wrote:
> 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 <weil@mail.berlios.de>
[snip]
> 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;
Please move this to qemu-os-win32.h instead, otherwise the build will
fail on POSIX systems due to setenv being redefined.
Thanks,
Jes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] win32: Add missing function setenv
2010-07-01 11:50 ` Jes Sorensen
@ 2010-07-01 13:22 ` Stefan Weil
2010-07-01 13:24 ` Jes Sorensen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2010-07-01 13:22 UTC (permalink / raw)
To: Jes Sorensen; +Cc: QEMU Developers
Am 01.07.2010 13:50, schrieb Jes Sorensen:
> On 07/01/10 12:47, Stefan Weil wrote:
>
>> 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<weil@mail.berlios.de>
>>
> [snip]
>
>> 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;
>>
> Please move this to qemu-os-win32.h instead, otherwise the build will
> fail on POSIX systems due to setenv being redefined.
>
> Thanks,
> Jes
>
It won't fail for two reasons:
* It is not redefined (at least for linux systems) because I used the
POSIX declaration.
* It is compiled only for _WIN32 (see line 95).
Regards
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] win32: Add missing function setenv
2010-07-01 13:22 ` Stefan Weil
@ 2010-07-01 13:24 ` Jes Sorensen
2010-07-01 15:51 ` Stefan Weil
0 siblings, 1 reply; 8+ messages in thread
From: Jes Sorensen @ 2010-07-01 13:24 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Developers
On 07/01/10 15:22, Stefan Weil wrote:
> It won't fail for two reasons:
>
> * It is not redefined (at least for linux systems) because I used the
> POSIX declaration.
This still fails with strict compiler flags.
> * It is compiled only for _WIN32 (see line 95).
True, but we need to move stuff out of osdep.h and into the other files
as much as possible, so it is still preferred that you move it.
Cheers,
Jes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] win32: Add missing function setenv
2010-07-01 13:24 ` Jes Sorensen
@ 2010-07-01 15:51 ` Stefan Weil
2010-07-01 15:53 ` Jes Sorensen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2010-07-01 15:51 UTC (permalink / raw)
To: Jes Sorensen; +Cc: QEMU Developers
Am 01.07.2010 15:24, schrieb Jes Sorensen:
> On 07/01/10 15:22, Stefan Weil wrote:
>> It won't fail for two reasons:
>>
>> * It is not redefined (at least for linux systems) because I used the
>> POSIX declaration.
>
> This still fails with strict compiler flags.
>
>> * It is compiled only for _WIN32 (see line 95).
>
> True, but we need to move stuff out of osdep.h and into the other files
> as much as possible, so it is still preferred that you move it.
That's a valid argument. As there is more stuff to move out of osdep.h,
I suggest doing that in a second step. Now, it is most important to get
Windows builds working again (they fail currently with a linker error).
>
> Cheers,
> Jes
>
Cheers,
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] win32: Add missing function setenv
2010-07-01 15:51 ` Stefan Weil
@ 2010-07-01 15:53 ` Jes Sorensen
2010-07-01 17:53 ` Stefan Weil
0 siblings, 1 reply; 8+ messages in thread
From: Jes Sorensen @ 2010-07-01 15:53 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Developers
On 07/01/10 17:51, Stefan Weil wrote:
> Am 01.07.2010 15:24, schrieb Jes Sorensen:
>> On 07/01/10 15:22, Stefan Weil wrote:
>>> It won't fail for two reasons:
>>>
>>> * It is not redefined (at least for linux systems) because I used the
>>> POSIX declaration.
>>
>> This still fails with strict compiler flags.
>>
>>> * It is compiled only for _WIN32 (see line 95).
>>
>> True, but we need to move stuff out of osdep.h and into the other files
>> as much as possible, so it is still preferred that you move it.
>
> That's a valid argument. As there is more stuff to move out of osdep.h,
> I suggest doing that in a second step. Now, it is most important to get
> Windows builds working again (they fail currently with a linker error).
Rather than add it to remove it in the next patch, please update your
patch and repost it. That causes less noise and will get win32 building
again just as fast.
Cheers,
Jes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] win32: Add missing function setenv
2010-07-01 15:53 ` Jes Sorensen
@ 2010-07-01 17:53 ` Stefan Weil
2010-07-02 8:40 ` Jes Sorensen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2010-07-01 17:53 UTC (permalink / raw)
To: Jes Sorensen; +Cc: QEMU Developers
Am 01.07.2010 17:53, schrieb Jes Sorensen:
> On 07/01/10 17:51, Stefan Weil wrote:
>
>> Am 01.07.2010 15:24, schrieb Jes Sorensen:
>>
>>> On 07/01/10 15:22, Stefan Weil wrote:
>>>
>>>> It won't fail for two reasons:
>>>>
>>>> * It is not redefined (at least for linux systems) because I used the
>>>> POSIX declaration.
>>>>
>>> This still fails with strict compiler flags.
>>>
>>>
>>>> * It is compiled only for _WIN32 (see line 95).
>>>>
>>> True, but we need to move stuff out of osdep.h and into the other files
>>> as much as possible, so it is still preferred that you move it.
>>>
>> That's a valid argument. As there is more stuff to move out of osdep.h,
>> I suggest doing that in a second step. Now, it is most important to get
>> Windows builds working again (they fail currently with a linker error).
>>
> Rather than add it to remove it in the next patch, please update your
> patch and repost it. That causes less noise and will get win32 building
> again just as fast.
>
> Cheers,
> Jes
>
Two patches are needed anyway.
For reasons of economy, I won't send a new patch.
Feel free do send one which meets your criteria.
Regards,
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] win32: Add missing function setenv
2010-07-01 17:53 ` Stefan Weil
@ 2010-07-02 8:40 ` Jes Sorensen
0 siblings, 0 replies; 8+ messages in thread
From: Jes Sorensen @ 2010-07-02 8:40 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Developers
On 07/01/10 19:53, Stefan Weil wrote:
> Two patches are needed anyway.
>
> For reasons of economy, I won't send a new patch.
> Feel free do send one which meets your criteria.
>
> Regards,
> Stefan
>
Well if you are not interested in working the way the community works,
please don't expect us to fix your bugs either.
Jes
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-07-02 8:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-01 10:47 [Qemu-devel] [PATCH] win32: Add missing function setenv Stefan Weil
2010-07-01 11:50 ` Jes Sorensen
2010-07-01 13:22 ` Stefan Weil
2010-07-01 13:24 ` Jes Sorensen
2010-07-01 15:51 ` Stefan Weil
2010-07-01 15:53 ` Jes Sorensen
2010-07-01 17:53 ` Stefan Weil
2010-07-02 8:40 ` Jes Sorensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).