Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: src/xz/util.h

Issue 7109015: Update XZ Utils to 5.0.3 (in deps) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/xz/suffix.c ('k') | src/xz/util.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /////////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////////
2 // 2 //
3 /// \file util.h 3 /// \file util.h
4 /// \brief Miscellaneous utility functions 4 /// \brief Miscellaneous utility functions
5 // 5 //
6 // Author: Lasse Collin 6 // Author: Lasse Collin
7 // 7 //
8 // This file has been put into the public domain. 8 // This file has been put into the public domain.
9 // You can do whatever you want with this file. 9 // You can do whatever you want with this file.
10 // 10 //
11 /////////////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////////////
12 12
13 /// \brief Safe malloc() that never returns NULL 13 /// \brief Safe malloc() that never returns NULL
14 /// 14 ///
15 /// \note xmalloc(), xrealloc(), and xstrdup() must not be used when 15 /// \note xmalloc(), xrealloc(), and xstrdup() must not be used when
16 /// there are files open for writing, that should be cleaned up 16 /// there are files open for writing, that should be cleaned up
17 /// before exiting. 17 /// before exiting.
18 #define xmalloc(size) xrealloc(NULL, size) 18 #define xmalloc(size) xrealloc(NULL, size)
19 19
20 20
21 /// \brief Safe realloc() that never returns NULL 21 /// \brief Safe realloc() that never returns NULL
22 extern void *xrealloc(void *ptr, size_t size); 22 extern void *xrealloc(void *ptr, size_t size)
23 » » lzma_attribute((__malloc__)) lzma_attr_alloc_size(2);
23 24
24 25
25 /// \brief Safe strdup() that never returns NULL 26 /// \brief Safe strdup() that never returns NULL
26 extern char *xstrdup(const char *src); 27 extern char *xstrdup(const char *src) lzma_attribute((__malloc__));
27 28
28 29
29 /// \brief Fancy version of strtoull() 30 /// \brief Fancy version of strtoull()
30 /// 31 ///
31 /// \param name Name of the option to show in case of an error 32 /// \param name Name of the option to show in case of an error
32 /// \param value String containing the number to be parsed; may 33 /// \param value String containing the number to be parsed; may
33 /// contain suffixes "k", "M", "G", "Ki", "Mi", or "Gi" 34 /// contain suffixes "k", "M", "G", "Ki", "Mi", or "Gi"
34 /// \param min Minimum valid value 35 /// \param min Minimum valid value
35 /// \param max Maximum valid value 36 /// \param max Maximum valid value
36 /// 37 ///
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 /// \return Pointer to statically allocated buffer containing the string. 90 /// \return Pointer to statically allocated buffer containing the string.
90 /// 91 ///
91 /// \note This uses double_to_str() internally so the static buffer 92 /// \note This uses double_to_str() internally so the static buffer
92 /// in double_to_str() will be overwritten. 93 /// in double_to_str() will be overwritten.
93 /// 94 ///
94 extern const char *uint64_to_nicestr(uint64_t value, 95 extern const char *uint64_to_nicestr(uint64_t value,
95 enum nicestr_unit unit_min, enum nicestr_unit unit_max, 96 enum nicestr_unit unit_min, enum nicestr_unit unit_max,
96 bool always_also_bytes, uint32_t slot); 97 bool always_also_bytes, uint32_t slot);
97 98
98 99
99 /// \brief Convert double to a string with one decimal place
100 ///
101 /// This is like uint64_to_str() except that this converts a double and
102 /// uses exactly one decimal place.
103 extern const char *double_to_str(double value);
104
105
106 /// \brief Wrapper for snprintf() to help constructing a string in pieces 100 /// \brief Wrapper for snprintf() to help constructing a string in pieces
107 /// 101 ///
108 /// A maximum of *left bytes is written starting from *pos. *pos and *left 102 /// A maximum of *left bytes is written starting from *pos. *pos and *left
109 /// are updated accordingly. 103 /// are updated accordingly.
110 extern void my_snprintf(char **pos, size_t *left, const char *fmt, ...) 104 extern void my_snprintf(char **pos, size_t *left, const char *fmt, ...)
111 » » lzma_attribute((format(printf, 3, 4))); 105 » » lzma_attribute((__format__(__printf__, 3, 4)));
112 106
113 107
114 /// \brief Check if filename is empty and print an error message 108 /// \brief Check if filename is empty and print an error message
115 extern bool is_empty_filename(const char *filename); 109 extern bool is_empty_filename(const char *filename);
116 110
117 111
118 /// \brief Test if stdin is a terminal 112 /// \brief Test if stdin is a terminal
119 /// 113 ///
120 /// If stdin is a terminal, an error message is printed and exit status set 114 /// If stdin is a terminal, an error message is printed and exit status set
121 /// to EXIT_ERROR. 115 /// to EXIT_ERROR.
122 extern bool is_tty_stdin(void); 116 extern bool is_tty_stdin(void);
123 117
124 118
125 /// \brief Test if stdout is a terminal 119 /// \brief Test if stdout is a terminal
126 /// 120 ///
127 /// If stdout is a terminal, an error message is printed and exit status set 121 /// If stdout is a terminal, an error message is printed and exit status set
128 /// to EXIT_ERROR. 122 /// to EXIT_ERROR.
129 extern bool is_tty_stdout(void); 123 extern bool is_tty_stdout(void);
OLDNEW
« no previous file with comments | « src/xz/suffix.c ('k') | src/xz/util.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698