Staging
v0.5.1
https://github.com/python/cpython
Revision b8f82e6febddbd534e0f08ab480367561daa0717 authored by Martin v. Löwis on 09 October 2006, 19:29:06 UTC, committed by Martin v. Löwis on 09 October 2006, 19:29:06 UTC
- reset errno before calling confstr - use confstr() doc to simplify
  checks afterwards
- Correct implementation and documentation of os.confstr.  Add a simple
  test case.  I've yet to figure out how to provoke a None return I can test.
- Address issues brought up by MvL on python-checkins.
  I tested this with valgrind on amd64.

  The man pages I found for diff architectures are inconsistent on this.
  I'm not entirely sure this change is correct for all architectures
  either.

  Perhaps we should just over-allocate and not worry about it?

The change to return None instead of "" in case of unconfigured
values has not been backported.
1 parent 2fafa25
Raw File
Tip revision: b8f82e6febddbd534e0f08ab480367561daa0717 authored by Martin v. Löwis on 09 October 2006, 19:29:06 UTC
Backport r45505, r45573, r45576
Tip revision: b8f82e6
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

char *
strdup(const char *str)
{
	if (str != NULL) {
		register char *copy = malloc(strlen(str) + 1);
		if (copy != NULL)
			return strcpy(copy, str);
	}
	return NULL;
}
back to top