code cleanup: use single define for undo string size, was 64 mostly, but 512 in the UI.

This commit is contained in:
Campbell Barton
2012-09-10 01:55:58 +00:00
parent eb9a7c2188
commit 61d40c38e0
8 changed files with 16 additions and 23 deletions

View File

@@ -83,6 +83,8 @@ void BKE_userdef_free(void);
void set_blender_test_break_cb(void (*func)(void) ); void set_blender_test_break_cb(void (*func)(void) );
int blender_test_break(void); int blender_test_break(void);
#define BKE_UNDO_STR_MAX 64
/* global undo */ /* global undo */
extern void BKE_write_undo(struct bContext *C, const char *name); extern void BKE_write_undo(struct bContext *C, const char *name);
extern void BKE_undo_step(struct bContext *C, int step); extern void BKE_undo_step(struct bContext *C, int step);

View File

@@ -463,11 +463,10 @@ int blender_test_break(void)
#define UNDO_DISK 0 #define UNDO_DISK 0
#define MAXUNDONAME 64
typedef struct UndoElem { typedef struct UndoElem {
struct UndoElem *next, *prev; struct UndoElem *next, *prev;
char str[FILE_MAX]; char str[FILE_MAX];
char name[MAXUNDONAME]; char name[BKE_UNDO_STR_MAX];
MemFile memfile; MemFile memfile;
uintptr_t undosize; uintptr_t undosize;
} UndoElem; } UndoElem;

View File

@@ -27,7 +27,6 @@
* \ingroup edgpencil * \ingroup edgpencil
*/ */
#include <stdio.h> #include <stdio.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -25,6 +25,10 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
/** \file blender/editors/gpencil/gpencil_undo.c
* \ingroup edgpencil
*/
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -34,6 +38,7 @@
#include "DNA_listBase.h" #include "DNA_listBase.h"
#include "DNA_windowmanager_types.h" #include "DNA_windowmanager_types.h"
#include "BKE_blender.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_gpencil.h" #include "BKE_gpencil.h"
@@ -46,12 +51,10 @@
#include "gpencil_intern.h" #include "gpencil_intern.h"
#define MAXUNDONAME 64
typedef struct bGPundonode { typedef struct bGPundonode {
struct bGPundonode *next, *prev; struct bGPundonode *next, *prev;
char name[MAXUNDONAME]; char name[BKE_UNDO_STR_MAX];
struct bGPdata *gpd; struct bGPdata *gpd;
} bGPundonode; } bGPundonode;

View File

@@ -197,7 +197,7 @@ typedef struct uiAfterFunc {
bContextStore *context; bContextStore *context;
char undostr[512]; char undostr[BKE_UNDO_STR_MAX];
int autokey; int autokey;
} uiAfterFunc; } uiAfterFunc;

View File

@@ -23,7 +23,6 @@
* \brief Undo system for painting and sculpting. * \brief Undo system for painting and sculpting.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -35,7 +34,7 @@
#include "DNA_userdef_types.h" #include "DNA_userdef_types.h"
#include "BKE_blender.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_global.h" #include "BKE_global.h"
@@ -43,11 +42,9 @@
#include "paint_intern.h" #include "paint_intern.h"
#define MAXUNDONAME 64
typedef struct UndoElem { typedef struct UndoElem {
struct UndoElem *next, *prev; struct UndoElem *next, *prev;
char name[MAXUNDONAME]; char name[BKE_UNDO_STR_MAX];
uintptr_t undosize; uintptr_t undosize;
ListBase elems; ListBase elems;
@@ -272,4 +269,3 @@ void ED_undo_paint_free(void)
undo_stack_free(&ImageUndoStack); undo_stack_free(&ImageUndoStack);
undo_stack_free(&MeshUndoStack); undo_stack_free(&MeshUndoStack);
} }

View File

@@ -29,8 +29,6 @@
* \ingroup edutil * \ingroup edutil
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
@@ -44,7 +42,7 @@
#include "BLI_dynstr.h" #include "BLI_dynstr.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_blender.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_depsgraph.h" #include "BKE_depsgraph.h"
#include "BKE_global.h" #include "BKE_global.h"
@@ -82,8 +80,6 @@
static void error(const char *UNUSED(arg)) {} static void error(const char *UNUSED(arg)) {}
/* ****** XXX ***** */ /* ****** XXX ***** */
#define MAXUNDONAME 64
typedef struct UndoElem { typedef struct UndoElem {
struct UndoElem *next, *prev; struct UndoElem *next, *prev;
ID id; // copy of editmode object ID ID id; // copy of editmode object ID
@@ -91,7 +87,7 @@ typedef struct UndoElem {
int type; // type of edited object int type; // type of edited object
void *undodata; void *undodata;
uintptr_t undosize; uintptr_t undosize;
char name[MAXUNDONAME]; char name[BKE_UNDO_STR_MAX];
void * (*getdata)(bContext * C); void * (*getdata)(bContext * C);
void (*freedata)(void *); void (*freedata)(void *);
void (*to_editmode)(void *, void *, void *); void (*to_editmode)(void *, void *, void *);

View File

@@ -74,8 +74,6 @@
#include "util_intern.h" #include "util_intern.h"
#define MAXUNDONAME 64 /* XXX, make common define */
/* ***************** generic undo system ********************* */ /* ***************** generic undo system ********************* */
void ED_undo_push(bContext *C, const char *str) void ED_undo_push(bContext *C, const char *str)
@@ -283,7 +281,7 @@ static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op))
static int ed_undo_push_exec(bContext *C, wmOperator *op) static int ed_undo_push_exec(bContext *C, wmOperator *op)
{ {
char str[MAXUNDONAME]; char str[BKE_UNDO_STR_MAX];
RNA_string_get(op->ptr, "message", str); RNA_string_get(op->ptr, "message", str);
ED_undo_push(C, str); ED_undo_push(C, str);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
@@ -321,7 +319,7 @@ void ED_OT_undo_push(wmOperatorType *ot)
ot->flag = OPTYPE_INTERNAL; ot->flag = OPTYPE_INTERNAL;
RNA_def_string(ot->srna, "message", "Add an undo step *function may be moved*", MAXUNDONAME, "Undo Message", ""); RNA_def_string(ot->srna, "message", "Add an undo step *function may be moved*", BKE_UNDO_STR_MAX, "Undo Message", "");
} }
void ED_OT_redo(wmOperatorType *ot) void ED_OT_redo(wmOperatorType *ot)