Mercurial > vim
comparison src/userfunc.c @ 30465:b3367a7a3914 v9.0.0568
patch 9.0.0568: autocmd code is indented more than needed
Commit: https://github.com/vim/vim/commit/e9dcf13a3007d4f603e007e0526b0005fd026bc5
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Sep 24 11:30:41 2022 +0100
patch 9.0.0568: autocmd code is indented more than needed
Problem: Autocmd code is indented more than needed.
Solution: Break out sooner. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/11208)
Also in user function code.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Sep 2022 12:45:03 +0200 |
parents | c2ef8f0f8ba1 |
children | d900f0561eee |
comparison
equal
deleted
inserted
replaced
30464:00e127edb23a | 30465:b3367a7a3914 |
---|---|
1879 | 1879 |
1880 /* | 1880 /* |
1881 * In a script change <SID>name() and s:name() to K_SNR 123_name(). | 1881 * In a script change <SID>name() and s:name() to K_SNR 123_name(). |
1882 * Change <SNR>123_name() to K_SNR 123_name(). | 1882 * Change <SNR>123_name() to K_SNR 123_name(). |
1883 * Use "fname_buf[FLEN_FIXED + 1]" when it fits, otherwise allocate memory | 1883 * Use "fname_buf[FLEN_FIXED + 1]" when it fits, otherwise allocate memory |
1884 * (slow). | 1884 * and set "tofree". |
1885 */ | 1885 */ |
1886 char_u * | 1886 char_u * |
1887 fname_trans_sid(char_u *name, char_u *fname_buf, char_u **tofree, int *error) | 1887 fname_trans_sid(char_u *name, char_u *fname_buf, char_u **tofree, int *error) |
1888 { | 1888 { |
1889 int llen; | 1889 int llen; |
1890 char_u *fname; | 1890 char_u *fname; |
1891 int i; | 1891 int i; |
1892 | 1892 |
1893 llen = eval_fname_script(name); | 1893 llen = eval_fname_script(name); |
1894 if (llen > 0) | 1894 if (llen == 0) |
1895 { | 1895 return name; // no prefix |
1896 fname_buf[0] = K_SPECIAL; | 1896 |
1897 fname_buf[1] = KS_EXTRA; | 1897 fname_buf[0] = K_SPECIAL; |
1898 fname_buf[2] = (int)KE_SNR; | 1898 fname_buf[1] = KS_EXTRA; |
1899 i = 3; | 1899 fname_buf[2] = (int)KE_SNR; |
1900 if (eval_fname_sid(name)) // "<SID>" or "s:" | 1900 i = 3; |
1901 { | 1901 if (eval_fname_sid(name)) // "<SID>" or "s:" |
1902 if (current_sctx.sc_sid <= 0) | 1902 { |
1903 *error = FCERR_SCRIPT; | 1903 if (current_sctx.sc_sid <= 0) |
1904 else | 1904 *error = FCERR_SCRIPT; |
1905 { | |
1906 sprintf((char *)fname_buf + 3, "%ld_", | |
1907 (long)current_sctx.sc_sid); | |
1908 i = (int)STRLEN(fname_buf); | |
1909 } | |
1910 } | |
1911 if (i + STRLEN(name + llen) < FLEN_FIXED) | |
1912 { | |
1913 STRCPY(fname_buf + i, name + llen); | |
1914 fname = fname_buf; | |
1915 } | |
1916 else | 1905 else |
1917 { | 1906 { |
1918 fname = alloc(i + STRLEN(name + llen) + 1); | 1907 sprintf((char *)fname_buf + 3, "%ld_", |
1919 if (fname == NULL) | 1908 (long)current_sctx.sc_sid); |
1920 *error = FCERR_OTHER; | 1909 i = (int)STRLEN(fname_buf); |
1921 else | 1910 } |
1922 { | 1911 } |
1923 *tofree = fname; | 1912 if (i + STRLEN(name + llen) < FLEN_FIXED) |
1924 mch_memmove(fname, fname_buf, (size_t)i); | 1913 { |
1925 STRCPY(fname + i, name + llen); | 1914 STRCPY(fname_buf + i, name + llen); |
1926 } | 1915 fname = fname_buf; |
1927 } | |
1928 } | 1916 } |
1929 else | 1917 else |
1930 fname = name; | 1918 { |
1919 fname = alloc(i + STRLEN(name + llen) + 1); | |
1920 if (fname == NULL) | |
1921 *error = FCERR_OTHER; | |
1922 else | |
1923 { | |
1924 *tofree = fname; | |
1925 mch_memmove(fname, fname_buf, (size_t)i); | |
1926 STRCPY(fname + i, name + llen); | |
1927 } | |
1928 } | |
1931 return fname; | 1929 return fname; |
1932 } | 1930 } |
1933 | 1931 |
1934 /* | 1932 /* |
1935 * Concatenate the script ID and function name into "<SNR>99_name". | 1933 * Concatenate the script ID and function name into "<SNR>99_name". |