Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
efed898a
Commit
efed898a
authored
Sep 13, 2018
by
antirez
Browse files
LOLWUT: Limit maximum CPU effort.
parent
eb0fbd71
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lolwut.c
View file @
efed898a
...
...
@@ -261,9 +261,14 @@ void lolwutCommand(client *c) {
getLongFromObjectOrReply
(
c
,
c
->
argv
[
3
],
&
squares_per_col
,
NULL
)
!=
C_OK
)
return
;
/* Limits. We want LOLWUT to be always reasonably fast and cheap to execute
* so we have maximum number of columns, rows, and output resulution. */
if
(
cols
<
1
)
cols
=
1
;
if
(
cols
>
1000
)
cols
=
1000
;
if
(
squares_per_row
<
1
)
squares_per_row
=
1
;
if
(
squares_per_row
>
200
)
squares_per_row
=
200
;
if
(
squares_per_col
<
1
)
squares_per_col
=
1
;
if
(
squares_per_col
>
200
)
squares_per_col
=
200
;
/* Generate some computer art and reply. */
lwCanvas
*
canvas
=
lwDrawSchotter
(
cols
,
squares_per_row
,
squares_per_col
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment