Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1566a17

Browse files
committed
Get hotshot closer to compiling on Windows.
Still broken: GETTIMEOFDAY. This macro obviously isn't being defined on Windows, so there's logic errors here I'd rather Fred untangled.
1 parent 3e99643 commit 1566a17

3 files changed

Lines changed: 30 additions & 3 deletions

File tree

Modules/_hotshot.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#ifdef MS_WIN32
2020
#include <windows.h>
2121
#include <largeint.h>
22+
#include <direct.h> /* for getcwd() */
2223
typedef LARGE_INTEGER hs_time;
2324
#else
2425
#ifndef HAVE_GETTIMEOFDAY
@@ -41,6 +42,14 @@ typedef struct timeval hs_time;
4142

4243
#define BUFFERSIZE 10240
4344

45+
#ifndef PATH_MAX
46+
# ifdef MAX_PATH
47+
# define PATH_MAX MAX_PATH
48+
# else
49+
# error "Need a defn. for PATH_MAX in _hotshot.c"
50+
# endif
51+
#endif
52+
4453
typedef struct {
4554
PyObject_HEAD
4655
PyObject *filemap;
@@ -365,6 +374,7 @@ logreader_tp_iternext(LogReaderObject *self)
365374
goto restart;
366375
}
367376
default:
377+
;
368378
}
369379
if (err == ERR_EOF && oldindex != 0) {
370380
/* It looks like we ran out of data before we had it all; this
@@ -470,7 +480,7 @@ flush_data(ProfilerObject *self)
470480
{
471481
/* Need to dump data to the log file... */
472482
size_t written = fwrite(self->buffer, 1, self->index, self->logfp);
473-
if (written == self->index)
483+
if (written == (size_t)self->index)
474484
self->index = 0;
475485
else {
476486
memmove(self->buffer, &self->buffer[written],
@@ -723,7 +733,7 @@ tracer_callback(ProfilerObject *self, PyFrameObject *frame, int what,
723733
case PyTrace_RETURN:
724734
pack_exit(self, get_tdelta(self));
725735
break;
726-
case PyTrace_LINE:
736+
case PyTrace_LINE:
727737
if (self->linetimings)
728738
pack_lineno_tdelta(self, frame->f_lineno, get_tdelta(self));
729739
else
@@ -1259,7 +1269,7 @@ hotshot_profiler(PyObject *unused, PyObject *args)
12591269
self->index = 0;
12601270
self->active = 0;
12611271
self->next_fileno = 0;
1262-
self->logfp = NULL;
1272+
self->logfp = NULL;
12631273
self->logfilename = PyTuple_GET_ITEM(args, 0);
12641274
Py_INCREF(self->logfilename);
12651275
self->filemap = PyDict_New();

PC/config.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ extern void init_locale(void);
4444
extern void init_codecs(void);
4545
extern void initxreadlines(void);
4646
extern void init_weakref(void);
47+
extern void init_hotshot(void);
4748
extern void initxxsubtype(void);
4849

4950
/* XXX tim: what's the purpose of ADDMODULE MARKER? */
@@ -98,6 +99,7 @@ struct _inittab _PyImport_Inittab[] = {
9899
{"_codecs", init_codecs},
99100
{"xreadlines", initxreadlines},
100101
{"_weakref", init_weakref},
102+
{"_hotshot", init_hotshot},
101103

102104
{"xxsubtype", initxxsubtype},
103105

PCbuild/pythoncore.dsp

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)