comparison Python/sysmodule.c @ 40230:a1863833c4e6 2.5

Backport 52501: Add some asserts. In sysmodule, I think these were to try to silence some warnings from Klokwork. They verify the assumptions of the format of svn version output. The assert in the thread module helped debug a problem on HP-UX.
author Neal Norwitz <nnorwitz@gmail.com>
date Sat, 28 Oct 2006 21:36:37 +0000
parents 6ba402b60041
children 86ab2f20a333
comparison
equal deleted inserted replaced
40222:2d5a5dedd975 40230:a1863833c4e6
981 if (!python) 981 if (!python)
982 Py_FatalError("subversion keywords missing"); 982 Py_FatalError("subversion keywords missing");
983 983
984 br_start = python + 8; 984 br_start = python + 8;
985 br_end = strchr(br_start, '/'); 985 br_end = strchr(br_start, '/');
986 assert(br_end);
987
986 /* Works even for trunk, 988 /* Works even for trunk,
987 as we are in trunk/Python/sysmodule.c */ 989 as we are in trunk/Python/sysmodule.c */
988 br_end2 = strchr(br_end+1, '/'); 990 br_end2 = strchr(br_end+1, '/');
989 991
990 istag = strncmp(br_start, "tags", 4) == 0; 992 istag = strncmp(br_start, "tags", 4) == 0;
993 strcpy(shortbranch, "trunk"); 995 strcpy(shortbranch, "trunk");
994 996
995 } 997 }
996 else if (istag || strncmp(br_start, "branches", 8) == 0) { 998 else if (istag || strncmp(br_start, "branches", 8) == 0) {
997 len = br_end2 - br_start; 999 len = br_end2 - br_start;
1000 assert(len >= 13);
1001 assert(len < (sizeof(patchlevel_revision) - 13));
998 strncpy(branch, br_start, len); 1002 strncpy(branch, br_start, len);
999 branch[len] = '\0'; 1003 branch[len] = '\0';
1000 1004
1001 len = br_end2 - (br_end + 1); 1005 len = br_end2 - (br_end + 1);
1002 strncpy(shortbranch, br_end + 1, len); 1006 strncpy(shortbranch, br_end + 1, len);